From 0d1e84cf553822001dfb126a9cb1af0289f30f44 Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Thu, 25 Nov 2021 16:00:10 +0900 Subject: [PATCH 1/5] Add more words Because apparently, we get at least 1 question about this everyday in Discord --- freqtrade/optimize/backtesting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 49957c2bb..15613cb06 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -89,7 +89,8 @@ class Backtesting: self.init_backtest_detail() self.pairlists = PairListManager(self.exchange, self.config) if 'VolumePairList' in self.pairlists.name_list: - raise OperationalException("VolumePairList not allowed for backtesting.") + raise OperationalException("VolumePairList not allowed for backtesting. " + "Please use StaticPairlist.") if 'PerformanceFilter' in self.pairlists.name_list: raise OperationalException("PerformanceFilter not allowed for backtesting.") From 0c629fc951f484019c4d563e8792f3c314088755 Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Thu, 25 Nov 2021 16:03:29 +0900 Subject: [PATCH 2/5] Update test_backtesting.py --- tests/optimize/test_backtesting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index ab7aa74a1..fb9282c2d 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -438,7 +438,7 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) -> Backtesting(default_conf) default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] - with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting.'): + with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): Backtesting(default_conf) default_conf.update({ @@ -470,7 +470,7 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti default_conf['timerange'] = '20180101-20180102' default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] - with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting.'): + with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): Backtesting(default_conf) default_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PerformanceFilter"}] From c23d90e2b84434a796ed9822ed00630df268c348 Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Thu, 25 Nov 2021 16:56:56 +0900 Subject: [PATCH 3/5] Update test_backtesting.py --- tests/optimize/test_backtesting.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index fb9282c2d..548d13b31 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -438,7 +438,8 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) -> Backtesting(default_conf) default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] - with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): + with pytest.raises(OperationalException, + match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): Backtesting(default_conf) default_conf.update({ @@ -470,7 +471,8 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti default_conf['timerange'] = '20180101-20180102' default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] - with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): + with pytest.raises(OperationalException, + match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): Backtesting(default_conf) default_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PerformanceFilter"}] From 5307d2bf3bfe3c8ed37143b9a9eda1cdd90183b3 Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Thu, 25 Nov 2021 17:04:04 +0900 Subject: [PATCH 4/5] Trimming the sentence --- freqtrade/optimize/backtesting.py | 2 +- tests/optimize/test_backtesting.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 15613cb06..b16aced28 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -90,7 +90,7 @@ class Backtesting: self.pairlists = PairListManager(self.exchange, self.config) if 'VolumePairList' in self.pairlists.name_list: raise OperationalException("VolumePairList not allowed for backtesting. " - "Please use StaticPairlist.") + "Use StaticPairlist.") if 'PerformanceFilter' in self.pairlists.name_list: raise OperationalException("PerformanceFilter not allowed for backtesting.") diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 548d13b31..2a017ed7d 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -439,7 +439,7 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) -> default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] with pytest.raises(OperationalException, - match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): + match='VolumePairList not allowed for backtesting. Use StaticPairlist.'): Backtesting(default_conf) default_conf.update({ @@ -472,7 +472,7 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] with pytest.raises(OperationalException, - match='VolumePairList not allowed for backtesting. Please use StaticPairlist.'): + match='VolumePairList not allowed for backtesting. Use StaticPairlist.'): Backtesting(default_conf) default_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PerformanceFilter"}] From 897788de17dc70c78d44fba6dfeb1366ab167f11 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 26 Nov 2021 06:27:06 +0100 Subject: [PATCH 5/5] Reformulate exception to be "nicer" --- freqtrade/optimize/backtesting.py | 2 +- tests/optimize/test_backtesting.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index b16aced28..219a4f069 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -90,7 +90,7 @@ class Backtesting: self.pairlists = PairListManager(self.exchange, self.config) if 'VolumePairList' in self.pairlists.name_list: raise OperationalException("VolumePairList not allowed for backtesting. " - "Use StaticPairlist.") + "Please use StaticPairlist instead.") if 'PerformanceFilter' in self.pairlists.name_list: raise OperationalException("PerformanceFilter not allowed for backtesting.") diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 2a017ed7d..f5e182c1d 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -439,7 +439,7 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) -> default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] with pytest.raises(OperationalException, - match='VolumePairList not allowed for backtesting. Use StaticPairlist.'): + match=r'VolumePairList not allowed for backtesting\..*StaticPairlist.*'): Backtesting(default_conf) default_conf.update({ @@ -472,7 +472,7 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti default_conf['pairlists'] = [{"method": "VolumePairList", "number_assets": 5}] with pytest.raises(OperationalException, - match='VolumePairList not allowed for backtesting. Use StaticPairlist.'): + match=r'VolumePairList not allowed for backtesting\..*StaticPairlist.*'): Backtesting(default_conf) default_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PerformanceFilter"}]