simplify exchange initialization
This commit is contained in:
parent
95e5c2e6c1
commit
ac32850034
@ -37,15 +37,12 @@ def init(config: dict) -> None:
|
|||||||
logger.info('Instance is running with dry_run enabled')
|
logger.info('Instance is running with dry_run enabled')
|
||||||
|
|
||||||
exchange_config = config['exchange']
|
exchange_config = config['exchange']
|
||||||
name = exchange_config['name']
|
|
||||||
|
|
||||||
# Find matching class for the given exchange name
|
# Find matching class for the given exchange name
|
||||||
exchange_class = None
|
name = exchange_config['name']
|
||||||
for exchange in Exchanges:
|
try:
|
||||||
if name.upper() == exchange.name:
|
exchange_class = Exchanges[name.upper()].value
|
||||||
exchange_class = exchange.value
|
except KeyError:
|
||||||
break
|
|
||||||
if not exchange_class:
|
|
||||||
raise RuntimeError('Exchange {} is not supported'.format(name))
|
raise RuntimeError('Exchange {} is not supported'.format(name))
|
||||||
|
|
||||||
EXCHANGE = exchange_class(exchange_config)
|
EXCHANGE = exchange_class(exchange_config)
|
||||||
|
Loading…
Reference in New Issue
Block a user