From dc0326db2737ba1bc213bab7f76bbffcc922c810 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Tue, 11 Jun 2019 10:09:30 +0300 Subject: [PATCH] fix handling --exchange --- freqtrade/arguments.py | 8 +------- scripts/download_backtest_data.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index 711975fd0..0d4288ef3 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -443,7 +443,7 @@ class Arguments(object): help='Log to the file specified', dest='logfile', type=str, - metavar='FILE' + metavar='FILE', ) self.parser.add_argument( '-c', '--config', @@ -458,15 +458,12 @@ class Arguments(object): '-d', '--datadir', help='Path to backtest data.', dest='datadir', - default=None, - type=str, metavar='PATH', ) self.parser.add_argument( '--pairs-file', help='File containing a list of pairs to download.', dest='pairs_file', - default=None, metavar='FILE', ) self.parser.add_argument( @@ -475,14 +472,11 @@ class Arguments(object): dest='days', type=int, metavar='INT', - default=None ) self.parser.add_argument( '--exchange', help='Exchange name (default: %(default)s). Only valid if no config is provided.', dest='exchange', - type=str, - default='bittrex' ) self.parser.add_argument( '-t', '--timeframes', diff --git a/scripts/download_backtest_data.py b/scripts/download_backtest_data.py index 196af5bed..278879fb0 100755 --- a/scripts/download_backtest_data.py +++ b/scripts/download_backtest_data.py @@ -27,6 +27,9 @@ arguments.download_data_options() # in the command line options explicitely args = arguments.parse_args(no_default_config=True) +# Use bittrex as default exchange +exchange_name = args.exchange or 'bittrex' + timeframes = args.timeframes pairs: List = [] @@ -46,20 +49,15 @@ if args.config: config['exchange']['key'] = '' config['exchange']['secret'] = '' - if args.exchange: - config['exchange']['name'] = args.exchange - pairs = config['exchange']['pair_whitelist'] timeframes = [config['ticker_interval']] else: - if not args.exchange: - sys.exit("No exchange specified.") config = { 'stake_currency': '', 'dry_run': True, 'exchange': { - 'name': args.exchange, + 'name': exchange_name, 'key': '', 'secret': '', 'pair_whitelist': [], @@ -71,6 +69,13 @@ else: } configuration._load_logging_config(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 +configuration.check_exchange(config) + configuration._load_datadir_config(config) dl_path = Path(config['datadir'])