mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Remove most explicit "supports backtesting" checks
This commit is contained in:
@@ -217,8 +217,6 @@ class Backtesting:
|
|||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
"VolumePairList not allowed for backtesting. Please use StaticPairList instead."
|
"VolumePairList not allowed for backtesting. Please use StaticPairList instead."
|
||||||
)
|
)
|
||||||
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:
|
if len(self.strategylist) > 1 and "PrecisionFilter" in self.pairlists.name_list:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ def test_backtesting_start_no_data(default_conf, mocker, caplog, testdatadir) ->
|
|||||||
backtesting.start()
|
backtesting.start()
|
||||||
|
|
||||||
|
|
||||||
def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) -> None:
|
def test_backtesting_no_pair_left(default_conf, mocker) -> None:
|
||||||
mocker.patch(f"{EXMS}.exchange_has", MagicMock(return_value=True))
|
mocker.patch(f"{EXMS}.exchange_has", MagicMock(return_value=True))
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"freqtrade.data.history.history_utils.load_pair_history",
|
"freqtrade.data.history.history_utils.load_pair_history",
|
||||||
@@ -449,13 +449,6 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) ->
|
|||||||
with pytest.raises(OperationalException, match="No pair in whitelist."):
|
with pytest.raises(OperationalException, match="No pair in whitelist."):
|
||||||
Backtesting(default_conf)
|
Backtesting(default_conf)
|
||||||
|
|
||||||
default_conf["pairlists"] = [{"method": "VolumePairList", "number_assets": 5}]
|
|
||||||
with pytest.raises(
|
|
||||||
OperationalException,
|
|
||||||
match=r"VolumePairList not allowed for backtesting\..*StaticPairList.*",
|
|
||||||
):
|
|
||||||
Backtesting(default_conf)
|
|
||||||
|
|
||||||
default_conf.update(
|
default_conf.update(
|
||||||
{
|
{
|
||||||
"pairlists": [{"method": "StaticPairList"}],
|
"pairlists": [{"method": "StaticPairList"}],
|
||||||
@@ -469,7 +462,7 @@ def test_backtesting_no_pair_left(default_conf, mocker, caplog, testdatadir) ->
|
|||||||
Backtesting(default_conf)
|
Backtesting(default_conf)
|
||||||
|
|
||||||
|
|
||||||
def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, tickers) -> None:
|
def test_backtesting_pairlist_list(default_conf, mocker, tickers) -> None:
|
||||||
mocker.patch(f"{EXMS}.exchange_has", MagicMock(return_value=True))
|
mocker.patch(f"{EXMS}.exchange_has", MagicMock(return_value=True))
|
||||||
mocker.patch(f"{EXMS}.get_tickers", tickers)
|
mocker.patch(f"{EXMS}.get_tickers", tickers)
|
||||||
mocker.patch(f"{EXMS}.price_to_precision", lambda s, x, y: y)
|
mocker.patch(f"{EXMS}.price_to_precision", lambda s, x, y: y)
|
||||||
@@ -495,12 +488,6 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti
|
|||||||
):
|
):
|
||||||
Backtesting(default_conf)
|
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"] = [
|
default_conf["pairlists"] = [
|
||||||
{"method": "StaticPairList"},
|
{"method": "StaticPairList"},
|
||||||
{"method": "PrecisionFilter"},
|
{"method": "PrecisionFilter"},
|
||||||
|
|||||||
Reference in New Issue
Block a user