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