python-binance

DepthCache

Attributes

attributesymbol
= symbol
attributeupdate_time
= None
attributeconv_typeCallable
= conv_type

Functions

func__init__(self, symbol, conv_type=float)

Initialise the DepthCache

:param symbol: Symbol to create depth cache for :type symbol: string :param conv_type: Optional type to represent price, and amount, default is float. :type conv_type: function.

paramself
paramsymbol
paramconv_typeCallable
= float

Returns

None
funcadd_bid(self, bid)

Add a bid to the cache

:param bid: :return:

paramself
parambid

Returns

None
funcadd_ask(self, ask)

Add an ask to the cache

:param ask: :return:

paramself
paramask

Returns

None
funcget_bids(self)

Get the current bids

:return: list of bids with price and quantity as conv_type

.. code-block:: python

[ [ 0.0001946, # Price 45.0 # Quantity ], [ 0.00019459, 2384.0 ], [ 0.00019158, 5219.0 ], [ 0.00019157, 1180.0 ], [ 0.00019082, 287.0 ] ]

paramself

Returns

None
funcget_asks(self)

Get the current asks

:return: list of asks with price and quantity as conv_type.

.. code-block:: python

[ [ 0.0001955, # Price 57.0' # Quantity ], [ 0.00019699, 778.0 ], [ 0.000197, 64.0 ], [ 0.00019709, 1130.0 ], [ 0.0001971, 385.0 ] ]

paramself

Returns

None
funcsort_depth(vals, reverse=False, conv_type=float)

Sort bids or asks by price

paramvals
paramreverse
= False
paramconv_typeCallable
= float

Returns

None

On this page