Add 'get_tickers' function to exchange and use it for dynamic whitelists

This commit is contained in:
enenn
2018-04-07 21:28:26 +02:00
parent 5fc8250ee4
commit 0c8ecf2b1f
2 changed files with 33 additions and 7 deletions

View File

@@ -226,6 +226,23 @@ def get_balances() -> dict:
raise OperationalException(e)
@retrier
def get_tickers() -> Dict:
try:
return _API.fetch_tickers()
except ccxt.NetworkError as e:
raise NetworkException(
'Could not load tickers due to networking error. Message: {}'.format(e)
)
except ccxt.BaseError as e:
raise OperationalException(e)
except ccxt.NotSupported as e:
raise OperationalException(
'Exchange {} does not support fetching tickers in batch.'
'Message: {}'.format(_API.name, e)
)
# TODO: remove refresh argument, keeping it to keep track of where it was intended to be used
@retrier
def get_ticker(pair: str, refresh: Optional[bool] = True) -> dict: