.ib.feed: trim bars frame to `start_dt`
parent
848c8ae533
commit
1776242413
|
|
@ -269,17 +269,26 @@ async def open_history_client(
|
||||||
and
|
and
|
||||||
first_dt < start_dt
|
first_dt < start_dt
|
||||||
):
|
):
|
||||||
bars_array = bars_array[
|
trimmed_bars = bars_array[
|
||||||
bars_array['time'] >= start_dt.timestamp()
|
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!
|
# TODO! rm this once we're more confident it never hits!
|
||||||
breakpoint()
|
breakpoint()
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f'OHLC-bars array start is gt `start_dt` limit !!\n'
|
f'OHLC-bars array start is gt `start_dt` limit !!\n'
|
||||||
f'start_dt: {start_dt}\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 (
|
return (
|
||||||
bars_array,
|
bars_array,
|
||||||
first_dt,
|
first_dt,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue