def _process_common_options(self, config: Dict[str, Any]) -> None: self._process_logging_options(config) self._process_strategy_options(config) if ('db_url' in self.args and self.args.db_url and self.args.db_url != constants.DEFAULT_DB_PROD_URL): config.update({'db_url': self.args.db_url}) logger.info('Parameter --db-url detected ...') if config.get('dry_run', False): logger.info('Dry run is enabled') if config.get('db_url') in [None, constants.DEFAULT_DB_PROD_URL]: # Default to in-memory db for dry_run if not specified config['db_url'] = constants.DEFAULT_DB_DRYRUN_URL else: if not config.get('db_url', None): config['db_url'] = constants.DEFAULT_DB_PROD_URL logger.info('Dry run is disabled') logger.info(f'Using DB: "{config["db_url"]}"') if config.get('forcebuy_enable', False): logger.warning('`forcebuy` RPC message enabled.') # Setting max_open_trades to infinite if -1 if config.get('max_open_trades') == -1: config['max_open_trades'] = float('inf') # Support for sd_notify if 'sd_notify' in self.args and self.args.sd_notify: config['internals'].update({'sd_notify': True}) # Check if the exchange set by the user is supported check_exchange(config)
def load_config(self) -> Dict[str, Any]: """ Extract information for sys.argv and load the bot configuration :return: Configuration dictionary """ # Load all configs config: Dict[str, Any] = self.load_from_files(self.args.get("config", [])) # Keep a copy of the original configuration file config['original_config'] = deepcopy(config) self._process_logging_options(config) self._process_runmode(config) self._process_common_options(config) self._process_trading_options(config) self._process_optimize_options(config) self._process_plot_options(config) # Check if the exchange set by the user is supported check_exchange( config, config.get('experimental', {}).get('block_bad_exchanges', True)) self._resolve_pairs_list(config) process_temporary_deprecated_settings(config) return config
def load_config(self) -> Dict[str, Any]: """ Extract information for sys.argv and load the bot configuration :return: Configuration dictionary """ # Load all configs config: Dict[str, Any] = Configuration.from_files(self.args.config) self._process_common_options(config) self._process_optimize_options(config) self._process_plot_options(config) self._process_runmode(config) # Check if the exchange set by the user is supported check_exchange( config, config.get('experimental', {}).get('block_bad_exchanges', True)) self._resolve_pairs_list(config) validate_config_consistency(config) return config
def load_config(self) -> Dict[str, Any]: """ Extract information for sys.argv and load the bot configuration :return: Configuration dictionary """ # Load all configs config: Dict[str, Any] = load_from_files(self.args.get("config", [])) # Load environment variables env_data = enironment_vars_to_dict() config = deep_merge_dicts(env_data, config) # Normalize config if 'internals' not in config: config['internals'] = {} if 'pairlists' not in config: config['pairlists'] = [] # Keep a copy of the original configuration file config['original_config'] = deepcopy(config) self._process_logging_options(config) self._process_runmode(config) self._process_common_options(config) self._process_trading_options(config) self._process_optimize_options(config) self._process_plot_options(config) self._process_data_options(config) # Check if the exchange set by the user is supported check_exchange( config, config.get('experimental', {}).get('block_bad_exchanges', True)) self._resolve_pairs_list(config) process_temporary_deprecated_settings(config) return config
def test_check_exchange(default_conf, caplog) -> None: # Test an officially supported by Freqtrade team exchange default_conf.get('exchange').update({'name': 'BITTREX'}) assert check_exchange(default_conf) assert log_has_re( r"Exchange .* is officially supported by the Freqtrade development team\.", caplog) caplog.clear() # Test an officially supported by Freqtrade team exchange default_conf.get('exchange').update({'name': 'binance'}) assert check_exchange(default_conf) assert log_has_re( r"Exchange .* is officially supported by the Freqtrade development team\.", caplog) caplog.clear() # Test an available exchange, supported by ccxt default_conf.get('exchange').update({'name': 'kraken'}) assert check_exchange(default_conf) assert log_has_re( r"Exchange .* is supported by ccxt and .* not officially supported " r"by the Freqtrade development team\. .*", caplog) caplog.clear() # Test a 'bad' exchange, which known to have serious problems default_conf.get('exchange').update({'name': 'bitmex'}) with pytest.raises( OperationalException, match=r"Exchange .* is known to not work with the bot yet.*"): check_exchange(default_conf) caplog.clear() # Test a 'bad' exchange with check_for_bad=False default_conf.get('exchange').update({'name': 'bitmex'}) assert check_exchange(default_conf, False) assert log_has_re( r"Exchange .* is supported by ccxt and .* not officially supported " r"by the Freqtrade development team\. .*", caplog) caplog.clear() # Test an invalid exchange default_conf.get('exchange').update({'name': 'unknown_exchange'}) with pytest.raises( OperationalException, match=r'.*Exchange "unknown_exchange" is not supported by ccxt ' r'and therefore not available for the bot.*'): check_exchange(default_conf)
'ccxt_async_config': { 'enableRateLimit': True, 'rateLimit': 200 } } } timeframes = args.timeframes or ['1m', '5m'] configuration._process_logging_options(config) if args.config and args.exchange: logger.warning("The --exchange option is ignored, " "using exchange settings from the configuration file.") # Check if the exchange set by the user is supported check_exchange(config) configuration._process_datadir_options(config) dl_path = Path(config['datadir']) pairs_file = Path(args.pairs_file) if args.pairs_file else dl_path.joinpath('pairs.json') if not pairs or args.pairs_file: logger.info(f'Reading pairs file "{pairs_file}".') # Download pairs from the pairs file if no config is specified # or if pairs file is specified explicitely if not pairs_file.exists(): sys.exit(f'No pairs file found with path "{pairs_file}".') with pairs_file.open() as file: