Merge pull request #4944 from brookmiles/fix-download-data-end-date

Add support for timerange end date to `download-data`
This commit is contained in:
Matthias 2021-05-17 19:35:32 +02:00 committed by GitHub
commit 26f5bc6584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,9 +265,13 @@ def _download_trades_history(exchange: Exchange,
""" """
try: try:
since = timerange.startts * 1000 if \ until = None
(timerange and timerange.starttype == 'date') else int(arrow.utcnow().shift( if (timerange and timerange.starttype == 'date'):
days=-new_pairs_days).float_timestamp) * 1000 since = timerange.startts * 1000
if timerange.stoptype == 'date':
until = timerange.stopts * 1000
else:
since = int(arrow.utcnow().shift(days=-new_pairs_days).float_timestamp) * 1000
trades = data_handler.trades_load(pair) trades = data_handler.trades_load(pair)
@ -295,6 +299,7 @@ def _download_trades_history(exchange: Exchange,
# Default since_ms to 30 days if nothing is given # Default since_ms to 30 days if nothing is given
new_trades = exchange.get_historic_trades(pair=pair, new_trades = exchange.get_historic_trades(pair=pair,
since=since, since=since,
until=until,
from_id=from_id, from_id=from_id,
) )
trades.extend(new_trades[1]) trades.extend(new_trades[1])