fix validate_timeframes(); test added

This commit is contained in:
hroff-1902
2019-07-03 01:03:38 +03:00
parent 687381f42c
commit b80cef964e
2 changed files with 31 additions and 6 deletions

View File

@@ -269,12 +269,15 @@ class Exchange(object):
"""
Checks if ticker interval from config is a supported timeframe on the exchange
"""
if not hasattr(self._api, "timeframes"):
# If timeframes is missing, the exchange probably has no fetchOHLCV method.
if not hasattr(self._api, "timeframes") or self._api.timeframes is None:
# If timeframes attribute is missing (or is None), 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')}")
f"The ccxt library does not provide the list of timeframes "
f"for the exchange \"{self.name}\" and this exchange "
f"is therefore not supported. ccxt fetchOHLCV: {self.exchange_has('fetchOHLCV')}")
timeframes = self._api.timeframes
if timeframe not in timeframes:
raise OperationalException(