change prints to logging
This commit is contained in:
parent
f463817c88
commit
11f535e79f
@ -36,7 +36,7 @@ config: Dict[str, Any] = {}
|
|||||||
if args.config:
|
if args.config:
|
||||||
# Now expecting a list of config filenames here, not a string
|
# Now expecting a list of config filenames here, not a string
|
||||||
for path in args.config:
|
for path in args.config:
|
||||||
print(f"Using config: {path}...")
|
logger.info(f"Using config: {path}...")
|
||||||
# Merge config options, overwriting old values
|
# Merge config options, overwriting old values
|
||||||
config = deep_merge_dicts(configuration._load_config_file(path), config)
|
config = deep_merge_dicts(configuration._load_config_file(path), config)
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ dl_path = Path(config['datadir'])
|
|||||||
pairs_file = Path(args.pairs_file) if args.pairs_file else dl_path.joinpath('pairs.json')
|
pairs_file = Path(args.pairs_file) if args.pairs_file else dl_path.joinpath('pairs.json')
|
||||||
|
|
||||||
if not pairs or args.pairs_file:
|
if not pairs or args.pairs_file:
|
||||||
print(f'Reading pairs file "{pairs_file}".')
|
logger.info(f'Reading pairs file "{pairs_file}".')
|
||||||
# Download pairs from the pairs file if no config is specified
|
# Download pairs from the pairs file if no config is specified
|
||||||
# or if pairs file is specified explicitely
|
# or if pairs file is specified explicitely
|
||||||
if not pairs_file.exists():
|
if not pairs_file.exists():
|
||||||
@ -94,7 +94,7 @@ if args.days:
|
|||||||
time_since = arrow.utcnow().shift(days=-args.days).strftime("%Y%m%d")
|
time_since = arrow.utcnow().shift(days=-args.days).strftime("%Y%m%d")
|
||||||
timerange = arguments.parse_timerange(f'{time_since}-')
|
timerange = arguments.parse_timerange(f'{time_since}-')
|
||||||
|
|
||||||
print(f'About to download pairs: {pairs}, intervals: {timeframes} to {dl_path}')
|
logger.info(f'About to download pairs: {pairs}, intervals: {timeframes} to {dl_path}')
|
||||||
|
|
||||||
pairs_not_available = []
|
pairs_not_available = []
|
||||||
|
|
||||||
@ -105,17 +105,17 @@ try:
|
|||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
if pair not in exchange._api.markets:
|
if pair not in exchange._api.markets:
|
||||||
pairs_not_available.append(pair)
|
pairs_not_available.append(pair)
|
||||||
print(f"skipping pair {pair}")
|
logger.info(f"skipping pair {pair}")
|
||||||
continue
|
continue
|
||||||
for ticker_interval in timeframes:
|
for ticker_interval in timeframes:
|
||||||
pair_print = pair.replace('/', '_')
|
pair_print = pair.replace('/', '_')
|
||||||
filename = f'{pair_print}-{ticker_interval}.json'
|
filename = f'{pair_print}-{ticker_interval}.json'
|
||||||
dl_file = dl_path.joinpath(filename)
|
dl_file = dl_path.joinpath(filename)
|
||||||
if args.erase and dl_file.exists():
|
if args.erase and dl_file.exists():
|
||||||
print(f'Deleting existing data for pair {pair}, interval {ticker_interval}')
|
logger.info(f'Deleting existing data for pair {pair}, interval {ticker_interval}')
|
||||||
dl_file.unlink()
|
dl_file.unlink()
|
||||||
|
|
||||||
print(f'downloading pair {pair}, interval {ticker_interval}')
|
logger.info(f'downloading pair {pair}, interval {ticker_interval}')
|
||||||
download_pair_history(datadir=dl_path, exchange=exchange,
|
download_pair_history(datadir=dl_path, exchange=exchange,
|
||||||
pair=pair, ticker_interval=ticker_interval,
|
pair=pair, ticker_interval=ticker_interval,
|
||||||
timerange=timerange)
|
timerange=timerange)
|
||||||
@ -125,4 +125,4 @@ except KeyboardInterrupt:
|
|||||||
|
|
||||||
finally:
|
finally:
|
||||||
if pairs_not_available:
|
if pairs_not_available:
|
||||||
print(f"Pairs [{','.join(pairs_not_available)}] not availble.")
|
logger.info(f"Pairs [{','.join(pairs_not_available)}] not availble.")
|
||||||
|
Loading…
Reference in New Issue
Block a user