From 6e15fd0da6867677323273505b65d084af782fbd Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 26 Jan 2025 12:56:57 +0100 Subject: [PATCH] feat: trades-fast download - improvements --- freqtrade/exchange/binance.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/freqtrade/exchange/binance.py b/freqtrade/exchange/binance.py index 18f915cae..4b35b666d 100644 --- a/freqtrade/exchange/binance.py +++ b/freqtrade/exchange/binance.py @@ -398,7 +398,7 @@ class Binance(Exchange): ) listing_date = trades[0]["timestamp"] since = max(since, listing_date) - logger.info("downloading fast") + _, res = await download_archive_trades( CandleType.SPOT, pair, @@ -407,13 +407,17 @@ class Binance(Exchange): markets=self.markets, ) - end_time = res[-1][0] - end_id = res[-1][1] - logger.info(f"downloaded fast {len(res)}") - if end_time < until: + if not res: + end_time = since + end_id = from_id + else: + end_time = res[-1][0] + end_id = res[-1][1] + if end_time >= until: return pair, res else: # continue + logger.info(f"downloaded fast {len(res)}, {end_time=}, {end_id=}") _, res2 = await super()._async_get_trade_history_id(pair, until, end_time, end_id) res.extend(res2) return pair, res