chore: improve variable naming in exchange_ws
This commit is contained in:
@@ -171,24 +171,24 @@ class ExchangeWS:
|
|||||||
pair: str,
|
pair: str,
|
||||||
timeframe: str,
|
timeframe: str,
|
||||||
candle_type: CandleType,
|
candle_type: CandleType,
|
||||||
candle_date: int,
|
candle_ts: int,
|
||||||
) -> OHLCVResponse:
|
) -> OHLCVResponse:
|
||||||
"""
|
"""
|
||||||
Returns cached klines from ccxt's "watch" cache.
|
Returns cached klines from ccxt's "watch" cache.
|
||||||
:param candle_date: timestamp of the end-time of the candle.
|
:param candle_ts: timestamp of the end-time of the candle we expect.
|
||||||
"""
|
"""
|
||||||
# Deepcopy the response - as it might be modified in the background as new messages arrive
|
# 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))
|
candles = deepcopy(self.ccxt_object.ohlcvs.get(pair, {}).get(timeframe))
|
||||||
refresh_date = self.klines_last_refresh[(pair, timeframe, candle_type)]
|
refresh_date = self.klines_last_refresh[(pair, timeframe, candle_type)]
|
||||||
drop_hint = False
|
drop_hint = False
|
||||||
if refresh_date > candle_date:
|
if refresh_date > candle_ts:
|
||||||
# Refreshed after candle was complete.
|
# Refreshed after candle was complete.
|
||||||
# logger.info(f"{candles[-1][0]} >= {candle_date}")
|
# logger.info(f"{candles[-1][0]} >= {candle_date}")
|
||||||
drop_hint = candles[-1][0] >= candle_date
|
drop_hint = candles[-1][0] >= candle_ts
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"watch result for {pair}, {timeframe} with length {len(candles)}, "
|
f"watch result for {pair}, {timeframe} with length {len(candles)}, "
|
||||||
f"{format_ms_time(candles[-1][0])}, "
|
f"{format_ms_time(candles[-1][0])}, "
|
||||||
f"lref={format_ms_time(refresh_date)}, "
|
f"lref={format_ms_time(refresh_date)}, "
|
||||||
f"candle_date={format_ms_time(candle_date)}, {drop_hint=}"
|
f"candle_ts={format_ms_time(candle_ts)}, {drop_hint=}"
|
||||||
)
|
)
|
||||||
return pair, timeframe, candle_type, candles, drop_hint
|
return pair, timeframe, candle_type, candles, drop_hint
|
||||||
|
|||||||
Reference in New Issue
Block a user