Improve readability of is_time_to_refresh function

This commit is contained in:
Matthias 2022-10-29 19:45:46 +02:00
parent b7d2c14f2c
commit 352adaf127

View File

@ -2004,11 +2004,8 @@ class Exchange:
def _now_is_time_to_refresh(self, pair: str, timeframe: str, candle_type: CandleType) -> bool: def _now_is_time_to_refresh(self, pair: str, timeframe: str, candle_type: CandleType) -> bool:
# Timeframe in seconds # Timeframe in seconds
interval_in_sec = timeframe_to_seconds(timeframe) interval_in_sec = timeframe_to_seconds(timeframe)
plr = self._pairs_last_refresh_time.get((pair, timeframe, candle_type), 0) + interval_in_sec
return ( return plr < arrow.utcnow().int_timestamp
(self._pairs_last_refresh_time.get((pair, timeframe, candle_type), 0)
+ interval_in_sec) < arrow.utcnow().int_timestamp
)
@retrier_async @retrier_async
async def _async_get_candle_history( async def _async_get_candle_history(