Check if the exchange is supported

This commit is contained in:
Gerald Lonlas
2018-03-30 13:14:35 -07:00
parent 96b2210c0f
commit 052404ffbd
3 changed files with 58 additions and 7 deletions

View File

@@ -74,16 +74,14 @@ def init(config: dict) -> None:
# Find matching class for the given exchange name
name = exchange_config['name']
# TODO add check for a list of supported exchanges
# Init the exchange if the exchange name passed is supported
try:
# exchange_class = Exchanges[name.upper()].value
_API = getattr(ccxt, name.lower())({
'apiKey': exchange_config.get('key'),
'secret': exchange_config.get('secret'),
})
logger.info('Using Exchange %s', name.capitalize())
except KeyError:
except (KeyError, AttributeError):
raise OperationalException('Exchange {} is not supported'.format(name))
# we need load api markets