Only store tick refresh time if we cache

This commit is contained in:
Matthias 2022-10-06 14:56:38 +00:00
parent 7c702dd106
commit 6e179c7699

View File

@ -1866,8 +1866,7 @@ class Exchange:
f"Time jump detected. Evicting cache for {pair}, {timeframe}, {candle_type}") f"Time jump detected. Evicting cache for {pair}, {timeframe}, {candle_type}")
del self._klines[(pair, timeframe, candle_type)] del self._klines[(pair, timeframe, candle_type)]
if (not since_ms if (not since_ms and (self._ft_has["ohlcv_require_since"] or not_all_data)):
and (self._ft_has["ohlcv_require_since"] or not_all_data)):
# Multiple calls for one pair - to get more history # Multiple calls for one pair - to get more history
one_call = timeframe_to_msecs(timeframe) * self.ohlcv_candle_limit( one_call = timeframe_to_msecs(timeframe) * self.ohlcv_candle_limit(
timeframe, candle_type, since_ms) timeframe, candle_type, since_ms)
@ -1917,7 +1916,7 @@ class Exchange:
def _process_ohlcv_df(self, pair: str, timeframe: str, c_type: CandleType, ticks: List[List], def _process_ohlcv_df(self, pair: str, timeframe: str, c_type: CandleType, ticks: List[List],
cache: bool, drop_incomplete: bool) -> DataFrame: cache: bool, drop_incomplete: bool) -> DataFrame:
# keeping last candle time as last refreshed time of the pair # keeping last candle time as last refreshed time of the pair
if ticks: if ticks and cache:
self._pairs_last_refresh_time[(pair, timeframe, c_type)] = ticks[-1][0] // 1000 self._pairs_last_refresh_time[(pair, timeframe, c_type)] = ticks[-1][0] // 1000
# keeping parsed dataframe in cache # keeping parsed dataframe in cache
ohlcv_df = ohlcv_to_dataframe(ticks, timeframe, pair=pair, fill_missing=True, ohlcv_df = ohlcv_to_dataframe(ticks, timeframe, pair=pair, fill_missing=True,