mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
@@ -11,7 +11,7 @@ from freqtrade.constants import Config, PairWithTimeframe
|
||||
from freqtrade.enums.candletype import CandleType
|
||||
from freqtrade.exchange.exchange import timeframe_to_seconds
|
||||
from freqtrade.exchange.exchange_types import OHLCVResponse
|
||||
from freqtrade.util import dt_ts, format_ms_time
|
||||
from freqtrade.util import dt_ts, format_ms_time, format_ms_time_det
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -180,15 +180,18 @@ class ExchangeWS:
|
||||
# Deepcopy the response - as it might be modified in the background as new messages arrive
|
||||
candles = deepcopy(self.ccxt_object.ohlcvs.get(pair, {}).get(timeframe))
|
||||
refresh_date = self.klines_last_refresh[(pair, timeframe, candle_type)]
|
||||
drop_hint = False
|
||||
if refresh_date > candle_ts:
|
||||
# Refreshed after candle was complete.
|
||||
# logger.info(f"{candles[-1][0]} >= {candle_date}")
|
||||
drop_hint = candles[-1][0] >= candle_ts
|
||||
received_ts = candles[-1][0] if candles else 0
|
||||
drop_hint = received_ts >= candle_ts
|
||||
if received_ts > refresh_date:
|
||||
logger.warning(
|
||||
f"{pair}, {timeframe} - Candle date > last refresh "
|
||||
f"({format_ms_time(received_ts)} > {format_ms_time_det(refresh_date)}). "
|
||||
"This usually suggests a problem with time synchronization."
|
||||
)
|
||||
logger.debug(
|
||||
f"watch result for {pair}, {timeframe} with length {len(candles)}, "
|
||||
f"{format_ms_time(candles[-1][0])}, "
|
||||
f"lref={format_ms_time(refresh_date)}, "
|
||||
f"r_ts={format_ms_time(received_ts)}, "
|
||||
f"lref={format_ms_time_det(refresh_date)}, "
|
||||
f"candle_ts={format_ms_time(candle_ts)}, {drop_hint=}"
|
||||
)
|
||||
return pair, timeframe, candle_type, candles, drop_hint
|
||||
|
||||
Reference in New Issue
Block a user