Catch too-early ib hist frames

For now by REPLing them and raising an RTE inside `.ib.feed` as well as
tracing any such cases that make it (from other providers) up to the
`.tsp._history` layer during null-segment backfilling.
multiaddrs
Gud Boi 2026-01-27 13:17:28 -05:00
parent ff502b62bf
commit 4081336bd3
2 changed files with 35 additions and 4 deletions

View File

@ -262,7 +262,29 @@ async def open_history_client(
vlm = bars_array['volume']
vlm[vlm < 0] = 0
return bars_array, first_dt, last_dt
# XXX, if a start-limit was passed ensure we only
# return history that far back!
if (
start_dt
and
last_dt < start_dt
):
bars_array = bars_array[
bars_array['time'] >= start_dt.timestamp()
]
# 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'
)
return (
bars_array,
first_dt,
last_dt,
)
# TODO: it seems like we can do async queries for ohlc
# but getting the order right still isn't working and I'm not
@ -451,6 +473,8 @@ async def get_bars(
dt_duration,
) = await proxy.bars(
fqme=fqme,
# XXX TODO! lol we're not using this..
# start_dt=start_dt,
end_dt=end_dt,
sample_period_s=timeframe,

View File

@ -242,6 +242,13 @@ async def maybe_fill_null_segments(
end_dt=end_dt,
)
if (
from_timestamp(
array['time'][0]
) < backfill_until_dt
):
await tractor.pause()
# XXX TODO: pretty sure if i plot tsla, btcusdt.binance
# and mnq.cme.ib this causes a Qt crash XXDDD