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 setdirection
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 sortsort_by
(descending),False
to NOT reverse (ascending). The defaultNone
will sort descending (reversed) whendirection
isbuy
, and ascending forsell
(direction-based sorting only applies whensort_by
is'price'
)sort_by (str) – (Default:
price
) The attribute ofSEOrder
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
orsell
Default:buy
- Raises
NoResult – Raised when
None
is returned byrpc.find
- Return List[SEOrder] orders
A list of
SEOrder
objects
- NOTE: By default, if