enhance check_exchange

This commit is contained in:
hroff-1902
2019-06-11 13:18:35 +03:00
parent 50c7a2445b
commit 676e730013
4 changed files with 50 additions and 17 deletions

View File

@@ -1,6 +1,8 @@
from freqtrade.exchange.exchange import Exchange # noqa: F401
from freqtrade.exchange.exchange import (is_exchange_supported, # noqa: F401
supported_exchanges)
from freqtrade.exchange.exchange import (is_exchange_bad, # noqa: F401
is_exchange_known,
is_exchange_officially_supported,
known_exchanges)
from freqtrade.exchange.exchange import (timeframe_to_seconds, # noqa: F401
timeframe_to_minutes,
timeframe_to_msecs)

View File

@@ -156,8 +156,8 @@ class Exchange(object):
# Find matching class for the given exchange name
name = exchange_config['name']
if not is_exchange_supported(name, ccxt_module):
raise OperationalException(f'Exchange {name} is not supported')
# if not is_exchange_supported(name, ccxt_module):
# raise OperationalException(f'Exchange {name} is not supported')
ex_config = {
'apiKey': exchange_config.get('key'),
@@ -722,11 +722,19 @@ class Exchange(object):
raise OperationalException(e)
def is_exchange_supported(exchange: str, ccxt_module=None) -> bool:
return exchange in supported_exchanges(ccxt_module)
def is_exchange_bad(exchange: str) -> bool:
return exchange in ['bitmex']
def supported_exchanges(ccxt_module=None) -> List[str]:
def is_exchange_known(exchange: str, ccxt_module=None) -> bool:
return exchange in known_exchanges(ccxt_module)
def is_exchange_officially_supported(exchange: str) -> bool:
return exchange in ['bittrex', 'binance']
def known_exchanges(ccxt_module=None) -> List[str]:
return ccxt_module.exchanges if ccxt_module is not None else ccxt.exchanges