From 5a02026f82decd18789f78440e4a71b51e24ff89 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 27 Feb 2020 19:35:58 +0100 Subject: [PATCH 1/2] Add test validating behaviour --- tests/test_configuration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index a58e88ea0..1e9d6440d 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -319,6 +319,7 @@ def test_load_dry_run(default_conf, mocker, config_value, expected, arglist) -> validated_conf = configuration.load_config() assert validated_conf['dry_run'] is expected + assert validated_conf['runmode'] == (RunMode.DRY_RUN if expected else RunMode.LIVE) def test_load_custom_strategy(default_conf, mocker) -> None: From a55964a6221c1806ba195bf7be1dfe4167fd15f2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 27 Feb 2020 19:36:54 +0100 Subject: [PATCH 2/2] we Must parse --dry-run before setting run-mode --- freqtrade/configuration/configuration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/freqtrade/configuration/configuration.py b/freqtrade/configuration/configuration.py index 035b091b3..6a0441957 100644 --- a/freqtrade/configuration/configuration.py +++ b/freqtrade/configuration/configuration.py @@ -167,10 +167,6 @@ class Configuration: if 'sd_notify' in self.args and self.args["sd_notify"]: config['internals'].update({'sd_notify': True}) - self._args_to_config(config, argname='dry_run', - logstring='Parameter --dry-run detected, ' - 'overriding dry_run to: {} ...') - def _process_datadir_options(self, config: Dict[str, Any]) -> None: """ Extract information for sys.argv and load directory configurations @@ -376,6 +372,10 @@ class Configuration: def _process_runmode(self, config: Dict[str, Any]) -> None: + self._args_to_config(config, argname='dry_run', + logstring='Parameter --dry-run detected, ' + 'overriding dry_run to: {} ...') + if not self.runmode: # Handle real mode, infer dry/live from config self.runmode = RunMode.DRY_RUN if config.get('dry_run', True) else RunMode.LIVE