From d7df5d57153c41d5c3a292b36bb312da6242afcb Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jan 2019 06:44:08 +0100 Subject: [PATCH] Keep last_pair_refresh as tuple asw ell --- freqtrade/exchange/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index 1fff1c1b5..44642476c 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -80,7 +80,7 @@ class Exchange(object): self._cached_ticker: Dict[str, Any] = {} # Holds last candle refreshed time of each pair - self._pairs_last_refresh_time: Dict[str, int] = {} + self._pairs_last_refresh_time: Dict[Tuple[str, str], int] = {} # Holds candles self._klines: Dict[Tuple[str, str], DataFrame] = {} @@ -545,7 +545,7 @@ class Exchange(object): # Calculating ticker interval in second interval_in_sec = constants.TICKER_INTERVAL_MINUTES[ticker_interval] * 60 - if not (self._pairs_last_refresh_time.get(pair, 0) + interval_in_sec >= + if not (self._pairs_last_refresh_time.get((pair, ticker_interval), 0) + interval_in_sec >= arrow.utcnow().timestamp and (pair, ticker_interval) in self._klines): input_coroutines.append(self._async_get_candle_history(pair, ticker_interval)) else: @@ -564,7 +564,7 @@ class Exchange(object): ticks = res[2] # keeping last candle time as last refreshed time of the pair if ticks: - self._pairs_last_refresh_time[pair] = ticks[-1][0] // 1000 + self._pairs_last_refresh_time[(pair, tick_interval)] = ticks[-1][0] // 1000 # keeping parsed dataframe in cache self._klines[(pair, tick_interval)] = parse_ticker_dataframe( ticks, tick_interval, fill_missing=True)