Source code for mlthon.order.books.level
from mlthon.basics.defs import Side
from mlthon.basics.price import Price
from mlthon.basics.qty import Qty
[docs]class Level(object):
def __init__(self, id: int, side: Side, price: Price, qty: Qty):
self._id_ = id
self._side_ = side
self._price_ = price
self._qty_ = qty
[docs] def get_side(self) -> Side:
return self._side_
[docs] def get_price(self) -> Price:
return self._price_
[docs] def get_qty(self) -> Qty:
return self._qty_
[docs] def update_qty(self, new_qty: Qty):
self._qty_ = new_qty
[docs] def get_id(self):
return self._id_
def __str__(self):
return "[" + str(self._id_) + "] " + self._side_.name + " " + str(self._qty_) + " @ " + str(self._price_)