mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
fix: capture ws edge-case on reconnect
This commit is contained in:
@@ -2449,7 +2449,15 @@ class Exchange:
|
|||||||
self._exchange_ws.klines_last_refresh.get((pair, timeframe, candle_type), 0)
|
self._exchange_ws.klines_last_refresh.get((pair, timeframe, candle_type), 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
if candles and candles[-1][0] >= prev_candle_ts and last_refresh_time >= half_candle:
|
if (
|
||||||
|
candles
|
||||||
|
and (
|
||||||
|
(len(candles) > 1 and candles[-1][0] >= prev_candle_ts)
|
||||||
|
# Edgecase on reconnect, where 1 candle is available but it's the current one
|
||||||
|
or (len(candles) == 1 and candles[-1][0] < candle_ts)
|
||||||
|
)
|
||||||
|
and last_refresh_time >= half_candle
|
||||||
|
):
|
||||||
# Usable result, candle contains the previous candle.
|
# Usable result, candle contains the previous candle.
|
||||||
# Also, we check if the last refresh time is no more than half the candle ago.
|
# Also, we check if the last refresh time is no more than half the candle ago.
|
||||||
logger.debug(f"reuse watch result for {pair}, {timeframe}, {last_refresh_time}")
|
logger.debug(f"reuse watch result for {pair}, {timeframe}, {last_refresh_time}")
|
||||||
|
|||||||
Reference in New Issue
Block a user