mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-13 03:33:55 +00:00
combine normalize method and config validation to in_files
This commit is contained in:
parent
afba31c3f9
commit
eb328037b7
|
@ -4,7 +4,7 @@ This module contains the configuration class
|
||||||
import logging
|
import logging
|
||||||
import warnings
|
import warnings
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from typing import Any, Callable, Dict, Optional, List
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from freqtrade import OperationalException, constants
|
from freqtrade import OperationalException, constants
|
||||||
from freqtrade.configuration.check_exchange import check_exchange
|
from freqtrade.configuration.check_exchange import check_exchange
|
||||||
|
@ -59,16 +59,16 @@ class Configuration(object):
|
||||||
# Merge config options, overwriting old values
|
# Merge config options, overwriting old values
|
||||||
config = deep_merge_dicts(load_config_file(path), config)
|
config = deep_merge_dicts(load_config_file(path), config)
|
||||||
|
|
||||||
return config
|
# Normalize config
|
||||||
|
|
||||||
def _normalize_config(self, config: Dict[str, Any]) -> None:
|
|
||||||
"""
|
|
||||||
Make config more canonical -- i.e. for example add missing parts that we expect
|
|
||||||
to be normally in it...
|
|
||||||
"""
|
|
||||||
if 'internals' not in config:
|
if 'internals' not in config:
|
||||||
config['internals'] = {}
|
config['internals'] = {}
|
||||||
|
|
||||||
|
# validate configuration before returning
|
||||||
|
logger.info('Validating configuration ...')
|
||||||
|
validate_config_schema(config)
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
def load_config(self) -> Dict[str, Any]:
|
def load_config(self) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Extract information for sys.argv and load the bot configuration
|
Extract information for sys.argv and load the bot configuration
|
||||||
|
@ -77,12 +77,6 @@ class Configuration(object):
|
||||||
# Load all configs
|
# Load all configs
|
||||||
config: Dict[str, Any] = Configuration.from_files(self.args.config)
|
config: Dict[str, Any] = Configuration.from_files(self.args.config)
|
||||||
|
|
||||||
# Make resulting config more canonical
|
|
||||||
self._normalize_config(config)
|
|
||||||
|
|
||||||
logger.info('Validating configuration ...')
|
|
||||||
validate_config_schema(config)
|
|
||||||
|
|
||||||
self._validate_config_consistency(config)
|
self._validate_config_consistency(config)
|
||||||
|
|
||||||
self._process_common_options(config)
|
self._process_common_options(config)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user