Skip to content

feat(trading-strategies): complete the running interval from minutes in BatchedIndicator.warmUp - #1419

Open
bennycode wants to merge 3 commits into
fix/candle-batcher-keep-first-batchfrom
feat/batched-indicator-backfill
Open

bennycode wants to merge 3 commits into
fix/candle-batcher-keep-first-batchfrom
feat/batched-indicator-backfill

Conversation

@bennycode

Copy link
Copy Markdown
Owner

Builds on #1418, please merge that first.

When live candles start in the middle of an interval, say at 10:20 for hourly bars, the batcher only sees the minutes from 10:20 on. The first bar it completes is missing 10:00 to 10:19, so its open, high, low and volume are off.

warmUp() now takes the latest 1-minute candles as an optional second argument. Minutes after the last warm-up bar go through the batcher, so the running interval is complete when live candles take over. An interval that finished between the last warm-up bar and now goes to the indicator. Minutes the warm-up bars already cover are skipped, so nothing is counted twice.

hourly.warmUp(
  await market.getRecentCandles(pair, sma.getRequiredInputs(), ms('1h')),
  await market.getRecentCandles(pair, 60, ms('1m'))
);

The Getting Started example uses the new argument.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant