FIx loading pairs-list
This commit is contained in:
parent
eebf39a1df
commit
75b2db4424
@ -346,10 +346,9 @@ class Configuration(object):
|
|||||||
# or if pairs file is specified explicitely
|
# or if pairs file is specified explicitely
|
||||||
if not pairs_file.exists():
|
if not pairs_file.exists():
|
||||||
raise OperationalException(f'No pairs file found with path "{pairs_file}".')
|
raise OperationalException(f'No pairs file found with path "{pairs_file}".')
|
||||||
|
with pairs_file.open('r') as f:
|
||||||
config['pairs'] = json_load(pairs_file)
|
config['pairs'] = json_load(f)
|
||||||
|
config['pairs'].sort()
|
||||||
config['pairs'].sort()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if "config" in self.args and self.args.config:
|
if "config" in self.args and self.args.config:
|
||||||
@ -357,7 +356,10 @@ class Configuration(object):
|
|||||||
config['pairs'] = config.get('exchange', {}).get('pair_whitelist')
|
config['pairs'] = config.get('exchange', {}).get('pair_whitelist')
|
||||||
else:
|
else:
|
||||||
# Fall back to /dl_path/pairs.json
|
# Fall back to /dl_path/pairs.json
|
||||||
pairs_file = Path(config['datadir']) / "pairs.json"
|
pairs_file = Path(config['datadir']) / config['exchange']['name'].lower() / "pairs.json"
|
||||||
|
print(config['datadir'])
|
||||||
if pairs_file.exists():
|
if pairs_file.exists():
|
||||||
config['pairs'] = json_load(pairs_file)
|
with pairs_file.open('r') as f:
|
||||||
config['pairs'].sort()
|
config['pairs'] = json_load(f)
|
||||||
|
if 'pairs' in config:
|
||||||
|
config['pairs'].sort()
|
||||||
|
@ -6,6 +6,7 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing.io import IO
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import rapidjson
|
import rapidjson
|
||||||
@ -60,7 +61,7 @@ def file_dump_json(filename: Path, data, is_zip=False) -> None:
|
|||||||
logger.debug(f'done json to "{filename}"')
|
logger.debug(f'done json to "{filename}"')
|
||||||
|
|
||||||
|
|
||||||
def json_load(datafile):
|
def json_load(datafile: IO):
|
||||||
"""
|
"""
|
||||||
load data with rapidjson
|
load data with rapidjson
|
||||||
Use this to have a consistent experience,
|
Use this to have a consistent experience,
|
||||||
|
Loading…
Reference in New Issue
Block a user