From 266031a6beebf4c27a33e63d0086400aa94bb485 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 16 Dec 2020 19:24:47 +0100 Subject: [PATCH] Disallow PerformanceFilter for backtesting closes #4072 --- docs/includes/pairlists.md | 6 ++++++ freqtrade/optimize/backtesting.py | 2 ++ tests/optimize/test_backtesting.py | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/docs/includes/pairlists.md b/docs/includes/pairlists.md index 844f1d70a..732dfa5bb 100644 --- a/docs/includes/pairlists.md +++ b/docs/includes/pairlists.md @@ -65,6 +65,9 @@ The `refresh_period` setting allows to define the period (in seconds), at which }], ``` +!!! Note + `VolumePairList` does not support backtesting mode. + #### AgeFilter Removes pairs that have been listed on the exchange for less than `min_days_listed` days (defaults to `10`). @@ -84,6 +87,9 @@ Sorts pairs by past trade performance, as follows: Trade count is used as a tie breaker. +!!! Note + `PerformanceFilter` does not support backtesting mode. + #### PrecisionFilter Filters low-value coins which would not allow setting stoplosses. diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index de9c52dad..639904975 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -102,6 +102,8 @@ class Backtesting: self.pairlists = PairListManager(self.exchange, self.config) if 'VolumePairList' in self.pairlists.name_list: raise OperationalException("VolumePairList not allowed for backtesting.") + if 'PerformanceFilter' in self.pairlists.name_list: + raise OperationalException("PerformanceFilter not allowed for backtesting.") if len(self.strategylist) > 1 and 'PrecisionFilter' in self.pairlists.name_list: raise OperationalException( diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 547e55db8..971f8d048 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -430,6 +430,11 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti with pytest.raises(OperationalException, match='VolumePairList not allowed for backtesting.'): Backtesting(default_conf) + default_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PerformanceFilter"}] + with pytest.raises(OperationalException, + match='PerformanceFilter not allowed for backtesting.'): + Backtesting(default_conf) + default_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PrecisionFilter"}, ] Backtesting(default_conf)