From a6d78a8615a91e18d9adc830bd615bca0f1faa72 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 22 Aug 2022 21:18:02 +0200 Subject: [PATCH] initialize Since parameter properly closes #7285 --- freqtrade/data/history/history_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index 04d0bf6d3..7a3fa4e0c 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -330,13 +330,12 @@ def _download_trades_history(exchange: Exchange, try: until = None + since = 0 if timerange: if timerange.starttype == 'date': since = timerange.startts * 1000 if timerange.stoptype == 'date': until = timerange.stopts * 1000 - else: - since = arrow.utcnow().shift(days=-new_pairs_days).int_timestamp * 1000 trades = data_handler.trades_load(pair) @@ -349,6 +348,9 @@ def _download_trades_history(exchange: Exchange, logger.info(f"Start earlier than available data. Redownloading trades for {pair}...") trades = [] + if not since: + since = arrow.utcnow().shift(days=-new_pairs_days).int_timestamp * 1000 + from_id = trades[-1][1] if trades else None if trades and since < trades[-1][0]: # Reset since to the last available point