move "since" fallback to be the last check

This commit is contained in:
Matthias
2023-08-20 11:44:40 +02:00
parent cf226afb1a
commit 3167938d43

View File

@@ -357,9 +357,6 @@ def _download_trades_history(exchange: Exchange,
f"available data. Redownloading trades for {pair}...")
trades = trades_list_to_df([])
if not since:
since = dt_ts(dt_now() - timedelta(days=new_pairs_days))
from_id = trades.iloc[-1]['id'] if not trades.empty else None
if not trades.empty and since < trades.iloc[-1]['timestamp']:
# Reset since to the last available point
@@ -368,6 +365,9 @@ def _download_trades_history(exchange: Exchange,
logger.info(f"Using last trade date -5s - Downloading trades for {pair} "
f"since: {format_ms_time(since)}.")
if not since:
since = dt_ts(dt_now() - timedelta(days=new_pairs_days))
logger.debug("Current Start: %s", 'None' if trades.empty else
f"{trades.iloc[0]['date']:{DATETIME_PRINT_FORMAT}}")
logger.debug("Current End: %s", 'None' if trades.empty else