From 57dee794d157ee12dbdbcf1bae0a033fa47bed6a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 25 Aug 2019 14:14:13 +0200 Subject: [PATCH] Fix end-reached for id-based trade-download --- freqtrade/exchange/exchange.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 158dfee9e..aed75df13 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -812,13 +812,15 @@ class Exchange: t = await self._async_fetch_trades(pair, params={self._trades_pagination_arg: from_id}) if len(t): - from_id = t[-1]['id'] - # TODO: eliminate duplicates (first trade = last from previous) trades.extend(t) - # Reached the end of the defined-download period - if until and t[-1]['timestamp'] > until: + if from_id == t[-1]['id'] or (until and t[-1]['timestamp'] > until): + print(f"from_id did not change.") print(f"Reached {t[-1]['timestamp']} > {until}") break + + # TODO: eliminate duplicates (first trade = last from previous) + # Reached the end of the defined-download period + from_id = t[-1]['id'] else: break