pub struct Level {
pub price: BookPrice,
pub orders: BTreeMap<OrderId, BookOrder>,
/* private fields */
}
Expand description
Represents a discrete price level in an order book.
The level maintains a collection of orders as well as tracking insertion order to preserve FIFO queue dynamics.
Fields§
§price: BookPrice
§orders: BTreeMap<OrderId, BookOrder>
Implementations§
Source§impl Level
impl Level
pub fn from_order(order: BookOrder) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn first(&self) -> Option<&BookOrder>
Sourcepub fn get_orders(&self) -> Vec<BookOrder>
pub fn get_orders(&self) -> Vec<BookOrder>
Returns the orders in the insertion order.
pub fn size(&self) -> f64
pub fn size_raw(&self) -> u64
pub fn exposure(&self) -> f64
pub fn exposure_raw(&self) -> u64
pub fn add_bulk(&mut self, orders: Vec<BookOrder>)
pub fn add(&mut self, order: BookOrder)
pub fn update(&mut self, order: BookOrder)
pub fn delete(&mut self, order: &BookOrder)
pub fn remove_by_id( &mut self, order_id: OrderId, sequence: u64, ts_event: UnixNanos, )
Trait Implementations§
Source§impl Ord for Level
impl Ord for Level
Source§impl PartialOrd for Level
impl PartialOrd for Level
Source§impl PyClassImpl for Level
impl PyClassImpl for Level
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§type ThreadChecker = SendablePyClass<Level>
type ThreadChecker = SendablePyClass<Level>
This handles following two situations: Read more
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyMethods<Level> for PyClassImplCollector<Level>
impl PyMethods<Level> for PyClassImplCollector<Level>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for Level
impl PyTypeInfo for Level
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type.impl DerefToPyAny for Level
impl Eq for Level
Auto Trait Implementations§
impl Freeze for Level
impl RefUnwindSafe for Level
impl Send for Level
impl Sync for Level
impl Unpin for Level
impl UnwindSafe for Level
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.