diff --git a/freqtrade/configuration/timerange.py b/freqtrade/configuration/timerange.py index 6072e296c..c3d4d2595 100644 --- a/freqtrade/configuration/timerange.py +++ b/freqtrade/configuration/timerange.py @@ -4,6 +4,7 @@ This module contains the argument manager class import logging import re from typing import Optional +from datetime import datetime, timezone import arrow @@ -33,6 +34,10 @@ class TimeRange: return (self.starttype == other.starttype and self.stoptype == other.stoptype and self.startts == other.startts and self.stopts == other.stopts) + def to_datetime(self) -> (datetime, datetime): + return datetime.fromtimestamp(self.startts, timezone.utc), \ + datetime.fromtimestamp(self.stopts, timezone.utc) + def subtract_start(self, seconds: int) -> None: """ Subtracts from startts if startts is set. diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index 7d65a1480..0e1efd14b 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -287,9 +287,12 @@ def refresh_backtest_ohlcv_data(exchange: Exchange, pairs: List[str], timeframes f'Deleting existing data for pair {pair}, interval {timeframe}.') logger.info(f'Downloading pair {pair}, interval {timeframe}.') + # What happens when until should be None? + since, until = timerange.to_datetime() _download_pair_history(datadir=datadir, exchange=exchange, pair=pair, timeframe=str(timeframe), - timerange=timerange, data_handler=data_handler) + since=since, until=until, + data_handler=data_handler) return pairs_not_available