pub struct OwnBookLevel {
pub price: BookPrice,
pub orders: IndexMap<ClientOrderId, OwnBookOrder>,
}
Fields§
§price: BookPrice
§orders: IndexMap<ClientOrderId, OwnBookOrder>
Implementations§
Source§impl OwnBookLevel
impl OwnBookLevel
Sourcepub fn new(price: BookPrice) -> Self
pub fn new(price: BookPrice) -> Self
Creates a new OwnBookLevel
instance.
Sourcepub fn from_order(order: OwnBookOrder) -> Self
pub fn from_order(order: OwnBookOrder) -> Self
Creates a new OwnBookLevel
from an order, using the order’s price and side.
Sourcepub fn first(&self) -> Option<&OwnBookOrder>
pub fn first(&self) -> Option<&OwnBookOrder>
Returns a reference to the first order at this price level in FIFO order.
Sourcepub fn iter(&self) -> impl Iterator<Item = &OwnBookOrder>
pub fn iter(&self) -> impl Iterator<Item = &OwnBookOrder>
Returns an iterator over the orders at this price level in FIFO order.
Sourcepub fn get_orders(&self) -> Vec<OwnBookOrder>
pub fn get_orders(&self) -> Vec<OwnBookOrder>
Returns all orders at this price level in FIFO insertion order.
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 add_bulk(&mut self, orders: Vec<OwnBookOrder>)
pub fn add_bulk(&mut self, orders: Vec<OwnBookOrder>)
Adds multiple orders to this price level in FIFO order. Orders must match the level’s price.
Sourcepub fn add(&mut self, order: OwnBookOrder)
pub fn add(&mut self, order: OwnBookOrder)
Adds an order to this price level. Order must match the level’s price.
Sourcepub fn update(&mut self, order: OwnBookOrder)
pub fn update(&mut self, order: OwnBookOrder)
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 delete(&mut self, client_order_id: &ClientOrderId) -> Result<()>
pub fn delete(&mut self, client_order_id: &ClientOrderId) -> Result<()>
Deletes an order from this price level.
Trait Implementations§
Source§impl Clone for OwnBookLevel
impl Clone for OwnBookLevel
Source§fn clone(&self) -> OwnBookLevel
fn clone(&self) -> OwnBookLevel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OwnBookLevel
impl Debug for OwnBookLevel
Source§impl Ord for OwnBookLevel
impl Ord for OwnBookLevel
Source§impl PartialEq for OwnBookLevel
impl PartialEq for OwnBookLevel
Source§impl PartialOrd for OwnBookLevel
impl PartialOrd for OwnBookLevel
impl Eq for OwnBookLevel
Auto Trait Implementations§
impl Freeze for OwnBookLevel
impl RefUnwindSafe for OwnBookLevel
impl Send for OwnBookLevel
impl Sync for OwnBookLevel
impl Unpin for OwnBookLevel
impl UnwindSafe for OwnBookLevel
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<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
key
and return true
if they are equal.