From 68adfc6607ba790ad3d26d8b1ef332d3190f886c Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 29 Aug 2019 06:42:56 +0200 Subject: [PATCH] Init exchange before datadir ... --- freqtrade/configuration/configuration.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/freqtrade/configuration/configuration.py b/freqtrade/configuration/configuration.py index f5480c53a..e58ce0de1 100644 --- a/freqtrade/configuration/configuration.py +++ b/freqtrade/configuration/configuration.py @@ -160,6 +160,11 @@ class Configuration(object): Extract information for sys.argv and load directory configurations --user-data, --datadir """ + # Check exchange parameter here - otherwise `datadir` might be wrong. + if "exchange" in self.args and self.args.exchange: + config['exchange']['name'] = self.args.exchange + logger.info(f"Using exchange {config['exchange']['name']}") + if 'user_data_dir' in self.args and self.args.user_data_dir: config.update({'user_data_dir': self.args.user_data_dir}) elif 'user_data_dir' not in config: @@ -297,10 +302,6 @@ class Configuration(object): self._args_to_config(config, argname='days', logstring='Detected --days: {}') - if "exchange" in self.args and self.args.exchange: - config['exchange']['name'] = self.args.exchange - logger.info(f"Using exchange {config['exchange']['name']}") - def _process_runmode(self, config: Dict[str, Any]) -> None: if not self.runmode: @@ -361,7 +362,7 @@ class Configuration(object): config['pairs'] = config.get('exchange', {}).get('pair_whitelist') else: # Fall back to /dl_path/pairs.json - pairs_file = Path(config['datadir']) / config['exchange']['name'].lower() / "pairs.json" + pairs_file = Path(config['datadir']) / "pairs.json" if pairs_file.exists(): with pairs_file.open('r') as f: config['pairs'] = json_load(f)