Skip to content

fix(@typedtrader/exchange): keep the first CandleBatcher batch for markets that open after midnight UTC - #1418

Open
bennycode wants to merge 3 commits into
mainfrom
fix/candle-batcher-keep-first-batch
Open

bennycode wants to merge 3 commits into
mainfrom
fix/candle-batcher-keep-first-batch

Conversation

@bennycode

@bennycode bennycode commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

This reverts #1417. Its check treated a first candle that doesn't open on a UTC interval boundary as the sign of a partial batch. Markets that close break that assumption: a US stock's session never starts at 00:00 UTC, so the first daily batch was always dropped, even when every candle of that day had been seen. A strategy on daily bars lost a whole session on every start.

The new fixture holds Alpaca's hourly AMD bars for 2026-10-07 and 2026-10-08. They only cover the regular session, and batching the first day reproduces high, low and close of Alpaca's own daily bar for 2026-10-07. The test pins that the day is emitted. A second fixture holds the hourly BTC/USD bars for the same days, which trade around the clock. Batched into days they match Alpaca's daily bars exactly.

A batch that really is partial, because the stream started mid-session, is handled in the next PR by replaying the interval's earlier minutes during warm-up in BatchedIndicator.

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