From b152585d9b9ad3e832734f91286bcb6690139b42 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 19 Oct 2019 11:13:10 +0200 Subject: [PATCH] exportfilename should respect configured user_data_dir --- freqtrade/configuration/cli_options.py | 3 --- freqtrade/configuration/configuration.py | 10 +++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/freqtrade/configuration/cli_options.py b/freqtrade/configuration/cli_options.py index 7e6a956ce..b5f534a12 100644 --- a/freqtrade/configuration/cli_options.py +++ b/freqtrade/configuration/cli_options.py @@ -2,7 +2,6 @@ Definition of cli arguments used in arguments.py """ import argparse -import os from freqtrade import __version__, constants @@ -141,8 +140,6 @@ AVAILABLE_CLI_OPTIONS = { 'Requires `--export` to be set as well. ' 'Example: `--export-filename=user_data/backtest_results/backtest_today.json`', metavar='PATH', - default=os.path.join('user_data', 'backtest_results', - 'backtest-result.json'), ), "fee": Arg( '--fee', diff --git a/freqtrade/configuration/configuration.py b/freqtrade/configuration/configuration.py index 665999efb..967f8b5b5 100644 --- a/freqtrade/configuration/configuration.py +++ b/freqtrade/configuration/configuration.py @@ -192,6 +192,13 @@ class Configuration: config.update({'datadir': create_datadir(config, self.args.get("datadir", None))}) logger.info('Using data directory: %s ...', config.get('datadir')) + if self.args.get('exportfilename'): + self._args_to_config(config, argname='exportfilename', + logstring='Storing backtest results to {} ...') + else: + config['exportfilename'] = (config['user_data_dir'] + / 'backtest_results/backtest-result.json') + def _process_optimize_options(self, config: Dict[str, Any]) -> None: # This will override the strategy configuration @@ -235,9 +242,6 @@ class Configuration: self._args_to_config(config, argname='export', logstring='Parameter --export detected: {} ...') - self._args_to_config(config, argname='exportfilename', - logstring='Storing backtest results to {} ...') - # Edge section: if 'stoploss_range' in self.args and self.args["stoploss_range"]: txt_range = eval(self.args["stoploss_range"])