fix handling --exchange

This commit is contained in:
hroff-1902 2019-06-11 10:09:30 +03:00
parent 1add432673
commit dc0326db27
2 changed files with 12 additions and 13 deletions

View File

@ -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',

View File

@ -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'])