feat: trades-fast download - improvements

This commit is contained in:
Matthias
2025-01-26 12:56:57 +01:00
parent 1f2dadc333
commit 6e15fd0da6
+9 -5
View File
@@ -398,7 +398,7 @@ class Binance(Exchange):
) )
listing_date = trades[0]["timestamp"] listing_date = trades[0]["timestamp"]
since = max(since, listing_date) since = max(since, listing_date)
logger.info("downloading fast")
_, res = await download_archive_trades( _, res = await download_archive_trades(
CandleType.SPOT, CandleType.SPOT,
pair, pair,
@@ -407,13 +407,17 @@ class Binance(Exchange):
markets=self.markets, markets=self.markets,
) )
end_time = res[-1][0] if not res:
end_id = res[-1][1] end_time = since
logger.info(f"downloaded fast {len(res)}") end_id = from_id
if end_time < until: else:
end_time = res[-1][0]
end_id = res[-1][1]
if end_time >= until:
return pair, res return pair, res
else: else:
# continue # 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) _, res2 = await super()._async_get_trade_history_id(pair, until, end_time, end_id)
res.extend(res2) res.extend(res2)
return pair, res return pair, res