Merge pull request #1996 from hroff-1902/fix/1995

fix #1995
This commit is contained in:
Matthias 2019-07-03 06:44:23 +02:00 committed by GitHub
commit b43594e4eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,6 +85,9 @@ class Exchange(object):
it does basic validation whether the specified exchange and pairs are valid. it does basic validation whether the specified exchange and pairs are valid.
:return: None :return: None
""" """
self._api: ccxt.Exchange = None
self._api_async: ccxt_async.Exchange = None
self._config.update(config) self._config.update(config)
self._cached_ticker: Dict[str, Any] = {} self._cached_ticker: Dict[str, Any] = {}
@ -117,9 +120,9 @@ class Exchange(object):
self._ohlcv_partial_candle = self._ft_has['ohlcv_partial_candle'] self._ohlcv_partial_candle = self._ft_has['ohlcv_partial_candle']
# Initialize ccxt objects # Initialize ccxt objects
self._api: ccxt.Exchange = self._init_ccxt( self._api = self._init_ccxt(
exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config')) exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config'))
self._api_async: ccxt_async.Exchange = self._init_ccxt( self._api_async = self._init_ccxt(
exchange_config, ccxt_async, ccxt_kwargs=exchange_config.get('ccxt_async_config')) exchange_config, ccxt_async, ccxt_kwargs=exchange_config.get('ccxt_async_config'))
logger.info('Using Exchange "%s"', self.name) logger.info('Using Exchange "%s"', self.name)
@ -173,6 +176,8 @@ class Exchange(object):
api = getattr(ccxt_module, name.lower())(ex_config) api = getattr(ccxt_module, name.lower())(ex_config)
except (KeyError, AttributeError): except (KeyError, AttributeError):
raise OperationalException(f'Exchange {name} is not supported') raise OperationalException(f'Exchange {name} is not supported')
except ccxt.BaseError as e:
raise OperationalException(f"Initialization of ccxt failed. Reason: {e}")
self.set_sandbox(api, exchange_config, name) self.set_sandbox(api, exchange_config, name)