Handle if ticker_interval in config.json is not supported on exchange.

Returns.

Tested positive and negative data.
The ticker list in constants.py may be obsolete now, im not sure.

 raise OperationalException(f'Invalid ticker {timeframe}, this Exchange supports {timeframes}')
freqtrade.OperationalException: Invalid ticker 14m, this Exchange supports {'1m': '1m', '3m': '3m', '5m': '5m', '15m': '15m', '30m': '30m', '1h': '1h', '2h': '2h', '4h': '4h', '6h': '6h', '8h': '8h', '12h': '12h', '1d': '1d', '3d': '3d', '1w': '1w', '1M': '1M'}
This commit is contained in:
creslinux 2018-07-05 11:57:59 +00:00
parent d8d0579c5a
commit 966668f48a
1 changed files with 11 additions and 0 deletions

View File

@ -70,6 +70,9 @@ class Exchange(object):
# Check if all pairs are available
self.validate_pairs(config['exchange']['pair_whitelist'])
# Check if timeframe is available
self.validate_timeframes(config['ticker_interval'])
def _init_ccxt(self, exchange_config: dict) -> ccxt.Exchange:
"""
Initialize ccxt with given config and return valid
@ -128,6 +131,14 @@ class Exchange(object):
raise OperationalException(
f'Pair {pair} is not available at {self.name}')
def validate_timeframes(self, timeframe: List[str]) -> None:
"""
Checks if ticker interval from config is a supported timeframe on the exchange
"""
timeframes=self._api.timeframes
if timeframe not in timeframes:
raise OperationalException(f'Invalid ticker {timeframe}, this Exchange supports {timeframes}')
def exchange_has(self, endpoint: str) -> bool:
"""
Checks if exchange implements a specific API endpoint.