.ib.feed: trim bars frame to `start_dt`

multiaddrs
Gud Boi 2026-01-27 17:37:25 -05:00
parent 848c8ae533
commit 1776242413
1 changed files with 17 additions and 8 deletions

View File

@ -269,17 +269,26 @@ async def open_history_client(
and
first_dt < start_dt
):
bars_array = bars_array[
trimmed_bars = bars_array[
bars_array['time'] >= start_dt.timestamp()
]
if (
trimmed_first_dt := from_timestamp(trimmed_bars['time'][0])
!=
start_dt
):
# TODO! rm this once we're more confident it never hits!
breakpoint()
raise RuntimeError(
f'OHLC-bars array start is gt `start_dt` limit !!\n'
f'start_dt: {start_dt}\n'
f'last_dt: {last_dt}\n'
f'first_dt: {first_dt}\n'
f'trimmed_first_dt: {trimmed_first_dt}\n'
)
# XXX, overwrite with start_dt-limited frame
bars_array = trimmed_bars
return (
bars_array,
first_dt,