From 9758bed250450eb54de455987de2c2c5b93ed6be Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Aug 2021 06:44:20 +0200 Subject: [PATCH] Fix refresh_latest_ohlcv bug --- freqtrade/exchange/exchange.py | 7 ++++++- freqtrade/plugins/pairlist/VolumePairList.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 9aa5b98a8..dbd72aca4 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1253,7 +1253,7 @@ class Exchange: logger.debug("Refreshing candle (OHLCV) data for %d pairs", len(pair_list)) input_coroutines = [] - + cached_pairs = [] # Gather coroutines to run for pair, timeframe in set(pair_list): if (((pair, timeframe) not in self._klines) @@ -1265,6 +1265,7 @@ class Exchange: "Using cached candle (OHLCV) data for pair %s, timeframe %s ...", pair, timeframe ) + cached_pairs.append((pair, timeframe)) results = asyncio.get_event_loop().run_until_complete( asyncio.gather(*input_coroutines, return_exceptions=True)) @@ -1287,6 +1288,10 @@ class Exchange: results_df[(pair, timeframe)] = ohlcv_df if cache: self._klines[(pair, timeframe)] = ohlcv_df + # Return cached klines + for pair, timeframe in cached_pairs: + results_df[(pair, timeframe)] = self.klines((pair, timeframe), copy=False) + return results_df def _now_is_time_to_refresh(self, pair: str, timeframe: str) -> bool: diff --git a/freqtrade/plugins/pairlist/VolumePairList.py b/freqtrade/plugins/pairlist/VolumePairList.py index 8d01aeee1..23291d39e 100644 --- a/freqtrade/plugins/pairlist/VolumePairList.py +++ b/freqtrade/plugins/pairlist/VolumePairList.py @@ -115,7 +115,7 @@ class VolumePairList(IPairList): pairlist = self._pair_cache.get('pairlist') if pairlist: # Item found - no refresh necessary - return pairlist + return pairlist.copy() else: # Use fresh pairlist # Check if pair quote currency equals to the stake currency.