Adjust binance stale-bar detection to 2x tolerance
Change the stale-bar check in `.binance.feed` from `timeframe` to `timeframe * 2` tolerance to avoid false-positive pauses when bars are slightly delayed but still within acceptable bounds. Styling, - add walrus operator to capture `_time_step` for debugger inspection. - add comment explaining the debug purpose of this check. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-coderefresh_annots
parent
964f207150
commit
a940018721
|
|
@ -275,9 +275,15 @@ async def open_history_client(
|
||||||
f'{times}'
|
f'{times}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# XXX, debug any case where the latest 1m bar we get is
|
||||||
|
# already another "sample's-step-old"..
|
||||||
if end_dt is None:
|
if end_dt is None:
|
||||||
inow: int = round(time.time())
|
inow: int = round(time.time())
|
||||||
if (inow - times[-1]) > 60:
|
if (
|
||||||
|
_time_step := (inow - times[-1])
|
||||||
|
>
|
||||||
|
timeframe * 2
|
||||||
|
):
|
||||||
await tractor.pause()
|
await tractor.pause()
|
||||||
|
|
||||||
start_dt = from_timestamp(times[0])
|
start_dt = from_timestamp(times[0])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue