From 0c7d14fe50694edd916c550b1c1213990146f648 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 30 Jun 2019 20:30:31 +0200 Subject: [PATCH] Check if timeframes is available and fail gracefully otherwise --- freqtrade/exchange/exchange.py | 7 +++++++ freqtrade/resolvers/exchange_resolver.py | 1 + 2 files changed, 8 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index b649a7b65..cefee999c 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -269,6 +269,13 @@ class Exchange(object): """ Checks if ticker interval from config is a supported timeframe on the exchange """ + logger.warning("validate_timerames") + if not hasattr(self._api, "timeframes"): + # If timeframes is missing, the exchange probably has no fetchOHLCV method. + # Therefore we also show that. + raise OperationalException( + f"This exchange ({self.name}) does not have a `timeframes` attribute and " + f"is therefore not supported. fetchOHLCV: {self.exchange_has('fetchOHLCV')}") timeframes = self._api.timeframes if timeframe not in timeframes: raise OperationalException( diff --git a/freqtrade/resolvers/exchange_resolver.py b/freqtrade/resolvers/exchange_resolver.py index 25a86dd0e..089f6306f 100644 --- a/freqtrade/resolvers/exchange_resolver.py +++ b/freqtrade/resolvers/exchange_resolver.py @@ -28,6 +28,7 @@ class ExchangeResolver(IResolver): except ImportError: logger.info( f"No {exchange_name} specific subclass found. Using the generic class instead.") + if not hasattr(self, "exchange"): self.exchange = Exchange(config) def _load_exchange(