Load config-file in download_backtest_data -

This commit is contained in:
Matthias 2018-12-25 13:14:28 +01:00
parent 8fbeb700d6
commit 34b93eb952
2 changed files with 35 additions and 16 deletions

View File

@ -378,6 +378,15 @@ class Arguments(object):
metavar='PATH', metavar='PATH',
) )
self.parser.add_argument(
'-c', '--config',
help='specify configuration file, used for additional exchange parameters',
dest='config',
default=None,
type=str,
metavar='PATH',
)
self.parser.add_argument( self.parser.add_argument(
'--days', '--days',
help='Download data for number of days', help='Download data for number of days',
@ -389,7 +398,7 @@ class Arguments(object):
self.parser.add_argument( self.parser.add_argument(
'--exchange', '--exchange',
help='Exchange name (default: %(default)s)', help='Exchange name (default: %(default)s). Only valid if no config is provided',
dest='exchange', dest='exchange',
type=str, type=str,
default='bittrex' default='bittrex'

View File

@ -10,7 +10,7 @@ from freqtrade 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 set_loggers from freqtrade.configuration import Configuration, set_loggers
import logging import logging
logging.basicConfig( logging.basicConfig(
@ -27,7 +27,29 @@ args = arguments.parse_args()
timeframes = args.timeframes timeframes = args.timeframes
dl_path = Path(DEFAULT_DL_PATH).joinpath(args.exchange) if args.config:
configuration = Configuration(args)
config = configuration._load_config_file(args.config)
# Ensure we do not use Exchange credentials
config['exchange']['key'] = ''
config['exchange']['secret'] = ''
else:
config = {'stake_currency': '',
'dry_run': True,
'exchange': {
'name': args.exchange,
'key': '',
'secret': '',
'pair_whitelist': [],
'ccxt_async_config': {
"enableRateLimit": False
}
}
}
dl_path = Path(DEFAULT_DL_PATH).joinpath(config['exchange']['name'])
if args.export: if args.export:
dl_path = Path(args.export) dl_path = Path(args.export)
@ -52,20 +74,8 @@ if args.days:
print(f'About to download pairs: {PAIRS} to {dl_path}') print(f'About to download pairs: {PAIRS} to {dl_path}')
# Init exchange # Init exchange
exchange = Exchange({'stake_currency': '', exchange = Exchange(config)
'dry_run': True,
'exchange': {
'name': args.exchange,
'key': '',
'secret': '',
'pair_whitelist': [],
'ccxt_async_config': {
"enableRateLimit": False
}
}
})
pairs_not_available = [] pairs_not_available = []
for pair in PAIRS: for pair in PAIRS: