From 611850bf91a343d056259f3bb6ab7bc9b683c59f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 18 Aug 2019 16:19:24 +0200 Subject: [PATCH] Add edge/dynamic_whitelist validation --- freqtrade/configuration/config_validation.py | 16 ++++++++++++++++ freqtrade/tests/test_configuration.py | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/freqtrade/configuration/config_validation.py b/freqtrade/configuration/config_validation.py index bda60f90b..92846b704 100644 --- a/freqtrade/configuration/config_validation.py +++ b/freqtrade/configuration/config_validation.py @@ -63,6 +63,7 @@ def validate_config_consistency(conf: Dict[str, Any]) -> None: """ # validating trailing stoploss _validate_trailing_stoploss(conf) + _validate_edge(conf) def _validate_trailing_stoploss(conf: Dict[str, Any]) -> None: @@ -84,3 +85,18 @@ def _validate_trailing_stoploss(conf: Dict[str, Any]) -> None: raise OperationalException( f'The config trailing_stop_positive_offset needs ' 'to be greater than trailing_stop_positive_offset in your config.') + + +def _validate_edge(conf: Dict[str, Any]) -> None: + """ + Edge and Dynamic whitelist should not both be enabled, since edge overrides dynamic whitelists. + """ + + if not conf.get('edge', {}).get('enabled'): + return + + if conf.get('pairlist', {}).get('method') == 'VolumePairList': + raise OperationalException( + "Edge and VolumePairList are incompatible, " + "Edge will override whatever pairs VolumePairlist selects." + ) diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index 3a0077ef2..19d2a28ee 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -638,6 +638,22 @@ def test_validate_tsl(default_conf): validate_config_consistency(default_conf) +def test_validate_edge(edge_conf): + edge_conf.update({"pairlist": { + "method": "VolumePairList", + }}) + + with pytest.raises(OperationalException, + match="Edge and VolumePairList are incompatible, " + "Edge will override whatever pairs VolumePairlist selects."): + validate_config_consistency(edge_conf) + + edge_conf.update({"pairlist": { + "method": "StaticPairList", + }}) + validate_config_consistency(edge_conf) + + def test_load_config_test_comments() -> None: """ Load config with comments