privex.steemengine.SteemEngineToken.SteemEngineToken.get_orderbook

SteemEngineToken.get_orderbook(symbol, direction='buy', user=None, limit=200, offset=0, indexes: Optional[list] = None, sort_by: str = 'price', sort_reverse=None, **query) List[SEOrder][source]

Get a list of open Steem/Hive Engine orders for a given symbol, by default will display 'buy' orders unless you set direction to 'sell'

NOTE: By default, if direction is 'buy', then the orders will be returned sorted by price - descending (highest first),

and for sell - ascending (lowest first).

Example:

>>> st = SteemEngineToken()
>>> o = st.get_orderbook('ENG', direction='sell')
>>> o[0]
<SEOrder account='someguy123' price='0.99' symbol='ENG' quantity='885.40249121'>
>>> str(o[0].timestamp)
'2019-07-26 10:46:18'

Sort by highest quantity first:

>>> st.get_orderbook('BEE', 'sell', sort_by='quantity', sort_reverse=True)

Sort by oldest order first:

>>> st.get_orderbook('BEE', 'sell', sort_by='timestamp')
Parameters
  • sort_reverse (bool) – True to reverse sort sort_by (descending), False to NOT reverse (ascending). The default None will sort descending (reversed) when direction is buy, and ascending for sell (direction-based sorting only applies when sort_by is 'price')

  • sort_by (str) – (Default: price) The attribute of SEOrder to sort by.

  • symbol (str) – The symbol to get the open orders for

  • limit (int) – Amount of orders to retrieve

  • offset (int) – Offset selection by this many rows (for pagination)

  • indexes (list) – A list of dictionary indexes, e.g. [dict(descending=False, index='timestamp')]

  • user (str) – If None , get all orders, otherwise only get orders by this user. Default: None

  • direction (str) – The direction of orders to get, either buy or sell Default: buy

Raises

NoResult – Raised when None is returned by rpc.find

Return List[SEOrder] orders

A list of SEOrder objects