Skip to content

Commit

Permalink
Init exchange before datadir ...
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Aug 29, 2019
1 parent ba0d7aa commit 68adfc6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions freqtrade/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ def _process_datadir_options(self, config: Dict[str, Any]) -> None:
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:
Expand Down Expand Up @@ -297,10 +302,6 @@ def _process_plot_options(self, config: Dict[str, Any]) -> None:
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:
Expand Down Expand Up @@ -361,7 +362,7 @@ def _resolve_pairs_list(self, config: Dict[str, Any]) -> None:
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)
Expand Down

0 comments on commit 68adfc6

Please sign in to comment.