support for multiple --config in the download_backtest_data.py utility

This commit is contained in:
hroff-1902 2019-02-20 17:00:35 +03:00
parent c08a2b6638
commit 87c82dea3d
2 changed files with 15 additions and 5 deletions

View File

@ -384,10 +384,10 @@ class Arguments(object):
self.parser.add_argument( self.parser.add_argument(
'-c', '--config', '-c', '--config',
help='Specify configuration file, used for additional exchange parameters. ' help='Specify configuration file (default: %(default)s). '
'Multiple --config options may be used.', 'Multiple --config options may be used.',
dest='config', dest='config',
default=None, action='append',
type=str, type=str,
metavar='PATH', metavar='PATH',
) )

View File

@ -5,12 +5,14 @@ import json
import sys import sys
from pathlib import Path from pathlib import Path
import arrow import arrow
from typing import Any, Dict
from freqtrade import arguments from freqtrade.arguments import Arguments
from freqtrade.arguments import TimeRange from freqtrade.arguments import TimeRange
from freqtrade.exchange import Exchange from freqtrade.exchange import Exchange
from freqtrade.data.history import download_pair_history from freqtrade.data.history import download_pair_history
from freqtrade.configuration import Configuration, set_loggers from freqtrade.configuration import Configuration, set_loggers
from freqtrade.misc import deep_merge_dicts
import logging import logging
logging.basicConfig( logging.basicConfig(
@ -21,7 +23,7 @@ set_loggers(0)
DEFAULT_DL_PATH = 'user_data/data' DEFAULT_DL_PATH = 'user_data/data'
arguments = arguments.Arguments(sys.argv[1:], 'download utility') arguments = Arguments(sys.argv[1:], 'download utility')
arguments.testdata_dl_options() arguments.testdata_dl_options()
args = arguments.parse_args() args = arguments.parse_args()
@ -29,7 +31,15 @@ timeframes = args.timeframes
if args.config: if args.config:
configuration = Configuration(args) configuration = Configuration(args)
config = configuration._load_config_file(args.config)
config: Dict[str, Any] = {}
# Now expecting a list of config filenames here, not a string
for path in args.config:
print('Using config: %s ...', path)
# Merge config options, overwriting old values
config = deep_merge_dicts(configuration._load_config_file(path), config)
### config = configuration._load_config_file(args.config)
config['stake_currency'] = '' config['stake_currency'] = ''
# Ensure we do not use Exchange credentials # Ensure we do not use Exchange credentials