Merge branch 'develop' into align_userdata
This commit is contained in:
@@ -135,7 +135,7 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
),
|
||||
"strategy_list": Arg(
|
||||
'--strategy-list',
|
||||
help='Provide a comma-separated list of strategies to backtest. '
|
||||
help='Provide a space-separated list of strategies to backtest. '
|
||||
'Please note that ticker-interval needs to be set either in config '
|
||||
'or via command line. When using this together with `--export trades`, '
|
||||
'the strategy-name is injected into the filename '
|
||||
|
@@ -1,9 +1,7 @@
|
||||
"""
|
||||
This module contains the configuration class
|
||||
"""
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
import warnings
|
||||
from argparse import Namespace
|
||||
from pathlib import Path
|
||||
@@ -13,6 +11,7 @@ from freqtrade import OperationalException, constants
|
||||
from freqtrade.configuration.check_exchange import check_exchange
|
||||
from freqtrade.configuration.directory_operations import create_datadir, create_userdata_dir
|
||||
from freqtrade.configuration.json_schema import validate_config_schema
|
||||
from freqtrade.configuration.load_config import load_config_file
|
||||
from freqtrade.loggers import setup_logging
|
||||
from freqtrade.misc import deep_merge_dicts
|
||||
from freqtrade.state import RunMode
|
||||
@@ -53,24 +52,7 @@ class Configuration(object):
|
||||
logger.info('Using config: %s ...', path)
|
||||
|
||||
# Merge config options, overwriting old values
|
||||
config = deep_merge_dicts(self._load_config_file(path), config)
|
||||
|
||||
return config
|
||||
|
||||
def _load_config_file(self, path: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Loads a config file from the given path
|
||||
:param path: path as str
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
try:
|
||||
# Read config from stdin if requested in the options
|
||||
with open(path) if path != '-' else sys.stdin as file:
|
||||
config = json.load(file)
|
||||
except FileNotFoundError:
|
||||
raise OperationalException(
|
||||
f'Config file "{path}" not found!'
|
||||
' Please create a config file or check whether it exists.')
|
||||
config = deep_merge_dicts(load_config_file(path), config)
|
||||
|
||||
return config
|
||||
|
||||
|
30
freqtrade/configuration/load_config.py
Normal file
30
freqtrade/configuration/load_config.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
This module contain functions to load the configuration file
|
||||
"""
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
from typing import Any, Dict
|
||||
|
||||
from freqtrade import OperationalException
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def load_config_file(path: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Loads a config file from the given path
|
||||
:param path: path as str
|
||||
:return: configuration as dictionary
|
||||
"""
|
||||
try:
|
||||
# Read config from stdin if requested in the options
|
||||
with open(path) if path != '-' else sys.stdin as file:
|
||||
config = json.load(file)
|
||||
except FileNotFoundError:
|
||||
raise OperationalException(
|
||||
f'Config file "{path}" not found!'
|
||||
' Please create a config file or check whether it exists.')
|
||||
|
||||
return config
|
Reference in New Issue
Block a user