From 704c66a04464db1c727322d518818e2348ab4b6c Mon Sep 17 00:00:00 2001 From: goodboy Date: Sat, 14 Feb 2026 16:57:36 -0500 Subject: [PATCH] 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-code --- piker/brokers/binance/feed.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/piker/brokers/binance/feed.py b/piker/brokers/binance/feed.py index 02f4c77a..b1dcda85 100644 --- a/piker/brokers/binance/feed.py +++ b/piker/brokers/binance/feed.py @@ -275,12 +275,14 @@ async def open_history_client( 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: inow: int = round(time.time()) if ( - (inow - times[-1]) + _time_step := (inow - times[-1]) > - timeframe + timeframe * 2 ): await tractor.pause()