Check if timeframes is available and fail gracefully otherwise
This commit is contained in:
parent
cdeb649d0b
commit
0c7d14fe50
@ -269,6 +269,13 @@ class Exchange(object):
|
|||||||
"""
|
"""
|
||||||
Checks if ticker interval from config is a supported timeframe on the exchange
|
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
|
timeframes = self._api.timeframes
|
||||||
if timeframe not in timeframes:
|
if timeframe not in timeframes:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
|
@ -28,6 +28,7 @@ class ExchangeResolver(IResolver):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"No {exchange_name} specific subclass found. Using the generic class instead.")
|
f"No {exchange_name} specific subclass found. Using the generic class instead.")
|
||||||
|
if not hasattr(self, "exchange"):
|
||||||
self.exchange = Exchange(config)
|
self.exchange = Exchange(config)
|
||||||
|
|
||||||
def _load_exchange(
|
def _load_exchange(
|
||||||
|
Loading…
Reference in New Issue
Block a user