From 399e308e07544f54c66d24b0abbfae3cce762355 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 19 Aug 2023 18:32:23 +0200 Subject: [PATCH] Fix bug in --dl-trades downloading --- freqtrade/data/history/history_utils.py | 5 +++-- tests/data/test_history.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index f18563fa4..5bb89069b 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -351,9 +351,10 @@ def _download_trades_history(exchange: Exchange, # DEFAULT_TRADES_COLUMNS: 0 -> timestamp # DEFAULT_TRADES_COLUMNS: 1 -> id - if not trades.empty and since < trades.iloc[0]['timestamp']: + if not trades.empty and since > 0 and since < trades.iloc[0]['timestamp']: # since is before the first trade - logger.info(f"Start earlier than available data. Redownloading trades for {pair}...") + logger.info(f"Start ({trades.iloc[0]['date']:{DATETIME_PRINT_FORMAT}}) earlier than " + f"available data. Redownloading trades for {pair}...") trades = trades_list_to_df([]) if not since: diff --git a/tests/data/test_history.py b/tests/data/test_history.py index 32b57d0cf..896221667 100644 --- a/tests/data/test_history.py +++ b/tests/data/test_history.py @@ -620,7 +620,7 @@ def test_download_trades_history(trades_history, mocker, default_conf, testdatad assert int(ght_mock.call_args_list[0][1]['since'] // 1000) == since_time assert ght_mock.call_args_list[0][1]['from_id'] is None - assert log_has_re(r'Start earlier than available data. Redownloading trades for.*', caplog) + assert log_has_re(r'Start .* earlier than available data. Redownloading trades for.*', caplog) _clean_test_file(file2)