Added feature to bid/buy cryptocurrency using book orders from exchange. The idea, is to get rates from the top 2 (depending on the config settings) of book orders instead of tickers. This way we can offset the lags from the OHLCV data.

This commit is contained in:
Nullart
2018-06-11 16:17:21 +08:00
parent f2fa9ce539
commit 882b30ef17
5 changed files with 36 additions and 8 deletions

View File

@@ -239,6 +239,19 @@ def get_balances() -> dict:
except ccxt.BaseError as e:
raise OperationalException(e)
@retrier
def get_order_book(pair: str, refresh: Optional[bool] = True) -> dict:
try:
return _API.fetch_order_book(pair)
except ccxt.NotSupported as e:
raise OperationalException(
f'Exchange {_API.name} does not support fetching order book.'
f'Message: {e}')
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
raise TemporaryError(
f'Could not load order book due to {e.__class__.__name__}. Message: {e}')
except ccxt.BaseError as e:
raise OperationalException(e)
@retrier
def get_tickers() -> Dict: