From 91fb9d0113d719d4e6d884e93ec7bc15017b4ccc Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Wed, 3 Jul 2019 05:02:44 +0300 Subject: [PATCH 1/2] fix #1995 --- freqtrade/exchange/exchange.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 2350c752f..556ede13a 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -85,6 +85,9 @@ class Exchange(object): it does basic validation whether the specified exchange and pairs are valid. :return: None """ + self._api: ccxt.Exchange = None + self._api_async: ccxt_async.Exchange = None + self._config.update(config) self._cached_ticker: Dict[str, Any] = {} @@ -117,9 +120,9 @@ class Exchange(object): self._ohlcv_partial_candle = self._ft_has['ohlcv_partial_candle'] # Initialize ccxt objects - self._api: ccxt.Exchange = self._init_ccxt( + self._api = self._init_ccxt( 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')) logger.info('Using Exchange "%s"', self.name) @@ -173,6 +176,8 @@ class Exchange(object): api = getattr(ccxt_module, name.lower())(ex_config) except (KeyError, AttributeError): raise OperationalException(f'Exchange {name} is not supported') + except ccxt.NotSupported as e: + raise OperationalException(f"Initialization of ccxt failed. Reason: {e}") self.set_sandbox(api, exchange_config, name) From d41b8cc96ec56b372889ab5ee213311586cb8c47 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Wed, 3 Jul 2019 05:13:41 +0300 Subject: [PATCH 2/2] catch ccxt.BaseError --- freqtrade/exchange/exchange.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 556ede13a..c3171b961 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -176,7 +176,7 @@ class Exchange(object): api = getattr(ccxt_module, name.lower())(ex_config) except (KeyError, AttributeError): raise OperationalException(f'Exchange {name} is not supported') - except ccxt.NotSupported as e: + except ccxt.BaseError as e: raise OperationalException(f"Initialization of ccxt failed. Reason: {e}") self.set_sandbox(api, exchange_config, name)