initialize Since parameter properly

closes #7285
This commit is contained in:
Matthias 2022-08-22 21:18:02 +02:00
parent fe7108ae75
commit a6d78a8615

View File

@ -330,13 +330,12 @@ def _download_trades_history(exchange: Exchange,
try:
until = None
since = 0
if timerange:
if timerange.starttype == 'date':
since = timerange.startts * 1000
if timerange.stoptype == 'date':
until = timerange.stopts * 1000
else:
since = arrow.utcnow().shift(days=-new_pairs_days).int_timestamp * 1000
trades = data_handler.trades_load(pair)
@ -349,6 +348,9 @@ def _download_trades_history(exchange: Exchange,
logger.info(f"Start earlier than available data. Redownloading trades for {pair}...")
trades = []
if not since:
since = arrow.utcnow().shift(days=-new_pairs_days).int_timestamp * 1000
from_id = trades[-1][1] if trades else None
if trades and since < trades[-1][0]:
# Reset since to the last available point