From 183dec866a47186b0f52c6c3d7257ba7fda1fce8 Mon Sep 17 00:00:00 2001 From: robcaulk Date: Thu, 21 Jul 2022 13:02:52 +0200 Subject: [PATCH] remove ability to backtest open ended timeranges (safer) --- freqtrade/freqai/data_kitchen.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index 162ee9380..132faaa86 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -741,9 +741,16 @@ class FreqaiDataKitchen: backtest_timerange = TimeRange.parse_timerange(backtest_tr) if backtest_timerange.stopts == 0: - backtest_timerange.stopts = int( - datetime.datetime.now(tz=datetime.timezone.utc).timestamp() - ) + # typically open ended time ranges do work, however, there are some edge cases where + # it does not. accomodating these kinds of edge cases just to allow open-ended + # timerange is not high enough priority to warrant the effort. It is safer for now + # to simply ask user to add their end date + raise OperationalException("FreqAI backtesting does not allow open ended timeranges. " + "Please indicate the end date of your desired backtesting. " + "timerange.") + # backtest_timerange.stopts = int( + # datetime.datetime.now(tz=datetime.timezone.utc).timestamp() + # ) backtest_timerange.startts = ( backtest_timerange.startts - backtest_period_days * SECONDS_IN_DAY