Merge pull request #1430 from freqtrade/download_data_config

Download data config
This commit is contained in:
Misagh 2018-12-25 13:32:11 +01:00 committed by GitHub
commit 8e5ea8620b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 16 deletions

View File

@ -378,6 +378,15 @@ class Arguments(object):
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(
'--days',
help='Download data for number of days',
@ -389,7 +398,7 @@ class Arguments(object):
self.parser.add_argument(
'--exchange',
help='Exchange name (default: %(default)s)',
help='Exchange name (default: %(default)s). Only valid if no config is provided',
dest='exchange',
type=str,
default='bittrex'

View File

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