pub struct BookLevel_API(/* private fields */);Expand description
C compatible Foreign Function Interface (FFI) for an underlying order bookBookLevel.
This struct wraps Level in a way that makes it compatible with C function
calls, enabling interaction with Level in a C environment.
It implements the Deref trait, allowing instances of Level_API to be
dereferenced to Level, providing access to Level’s methods without
having to manually acce wss the underlying Level instance.
Implementations§
Source§impl BookLevel_API
impl BookLevel_API
Sourcepub fn new(level: BookLevel) -> Self
pub fn new(level: BookLevel) -> Self
Creates a new BookLevel_API instance.
Methods from Deref<Target = BookLevel>§
pub fn side(&self) -> OrderSideSpecified
Sourcepub fn first(&self) -> Option<&BookOrder>
pub fn first(&self) -> Option<&BookOrder>
Returns a reference to the first order at this price level in FIFO order.
Sourcepub fn iter(&self) -> impl Iterator<Item = &BookOrder>
pub fn iter(&self) -> impl Iterator<Item = &BookOrder>
Returns an iterator over the orders at this price level in FIFO order.
Sourcepub fn get_orders(&self) -> Vec<BookOrder>
pub fn get_orders(&self) -> Vec<BookOrder>
Returns all orders at this price level in FIFO insertion order.
Sourcepub fn size_raw(&self) -> QuantityRaw
pub fn size_raw(&self) -> QuantityRaw
Returns the total size of all orders at this price level as raw integer units.
Sourcepub fn size_decimal(&self) -> Decimal
pub fn size_decimal(&self) -> Decimal
Returns the total size of all orders at this price level as a decimal.
Sourcepub fn exposure(&self) -> f64
pub fn exposure(&self) -> f64
Returns the total exposure (price * size) of all orders at this price level as a float.
Sourcepub fn exposure_raw(&self) -> QuantityRaw
pub fn exposure_raw(&self) -> QuantityRaw
Returns the total exposure (price * size) of all orders at this price level as raw integer units.
Saturates at QuantityRaw::MAX if the total exposure would overflow.
Sourcepub fn add_bulk(&mut self, orders: Vec<BookOrder>)
pub fn add_bulk(&mut self, orders: Vec<BookOrder>)
Adds multiple orders to this price level in FIFO order. Orders must match the level’s price.
Sourcepub fn add(&mut self, order: BookOrder)
pub fn add(&mut self, order: BookOrder)
Adds an order to this price level. Order must match the level’s price.
Sourcepub fn update(&mut self, order: BookOrder)
pub fn update(&mut self, order: BookOrder)
Updates an existing order at this price level. Updated order must match the level’s price. Removes the order if size becomes zero.
Sourcepub fn remove_by_id(
&mut self,
order_id: OrderId,
sequence: u64,
ts_event: UnixNanos,
)
pub fn remove_by_id( &mut self, order_id: OrderId, sequence: u64, ts_event: UnixNanos, )
Removes an order by its ID.
§Panics
Panics if no order with the given order_id exists at this level.
Trait Implementations§
Source§impl Clone for BookLevel_API
impl Clone for BookLevel_API
Source§fn clone(&self) -> BookLevel_API
fn clone(&self) -> BookLevel_API
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BookLevel_API
impl Debug for BookLevel_API
Source§impl Deref for BookLevel_API
impl Deref for BookLevel_API
Source§impl DerefMut for BookLevel_API
impl DerefMut for BookLevel_API
Auto Trait Implementations§
impl Freeze for BookLevel_API
impl RefUnwindSafe for BookLevel_API
impl Send for BookLevel_API
impl Sync for BookLevel_API
impl Unpin for BookLevel_API
impl UnwindSafe for BookLevel_API
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more