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:
@@ -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:
|
||||
|
Reference in New Issue
Block a user