DepthCache
Attributes
attributesymbol= symbolattributeupdate_time= Noneattributeconv_typeCallable= conv_typeFunctions
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.
paramselfparamsymbolparamconv_typeCallable= floatReturns
Nonefuncadd_bid(self, bid)Add a bid to the cache
:param bid: :return:
paramselfparambidReturns
Nonefuncadd_ask(self, ask)Add an ask to the cache
:param ask: :return:
paramselfparamaskReturns
Nonefuncget_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 ] ]
paramselfReturns
Nonefuncget_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 ] ]
paramselfReturns
Nonefuncsort_depth(vals, reverse=False, conv_type=float)Sort bids or asks by price
paramvalsparamreverse= Falseparamconv_typeCallable= floatReturns
None