From db66b82f6fc432bc16cdb07b4269deb3163a06e5 Mon Sep 17 00:00:00 2001 From: robcaulk Date: Tue, 17 May 2022 19:50:06 +0200 Subject: [PATCH] accept open-ended timeranges from user --- freqtrade/freqai/data_kitchen.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index cfdbac5f5..8ccb95dbe 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -312,6 +312,9 @@ class FreqaiDataKitchen: full_timerange = TimeRange.parse_timerange(tr) config_timerange = TimeRange.parse_timerange(self.config["timerange"]) + if config_timerange.stopts == 0: + config_timerange.stopts = int(datetime.datetime.now( + tz=datetime.timezone.utc).timestamp()) timerange_train = copy.deepcopy(full_timerange) timerange_backtest = copy.deepcopy(full_timerange) @@ -589,6 +592,10 @@ class FreqaiDataKitchen: def create_fulltimerange(self, backtest_tr: str, backtest_period: int) -> str: backtest_timerange = TimeRange.parse_timerange(backtest_tr) + if backtest_timerange.stopts == 0: + backtest_timerange.stopts = int(datetime.datetime.now( + tz=datetime.timezone.utc).timestamp()) + backtest_timerange.startts = backtest_timerange.startts - backtest_period * SECONDS_IN_DAY start = datetime.datetime.utcfromtimestamp(backtest_timerange.startts) stop = datetime.datetime.utcfromtimestamp(backtest_timerange.stopts)