pub struct LimitBook<const LEVELS_INITIAL_CAPACITY: usize = 2048> { /* private fields */ }Expand description
Limit order book that manages limit orders and price levels
Implementations§
Source§impl LimitBook
impl LimitBook
Sourcepub fn best_bid_price(&self) -> Option<Price>
pub fn best_bid_price(&self) -> Option<Price>
Get the best bid price, if exists
Sourcepub fn best_ask_price(&self) -> Option<Price>
pub fn best_ask_price(&self) -> Option<Price>
Get the best ask price, if exists
Sourcepub fn best_bid_size(&self) -> Option<Quantity>
pub fn best_bid_size(&self) -> Option<Quantity>
Get the best bid size, if exists
Sourcepub fn best_ask_size(&self) -> Option<Quantity>
pub fn best_ask_size(&self) -> Option<Quantity>
Get the best ask size, if exists
Sourcepub fn is_side_empty(&self, side: Side) -> bool
pub fn is_side_empty(&self, side: Side) -> bool
Check if the side is empty
Sourcepub fn has_crossable_order(&self, taker_side: Side, limit_price: Price) -> bool
pub fn has_crossable_order(&self, taker_side: Side, limit_price: Price) -> bool
Check if there is a crossable order at the given limit price
Sourcepub fn micro_price(&self) -> Option<f64>
pub fn micro_price(&self) -> Option<f64>
Calculate the micro price, which weights the best bid and ask by the opposite side’s liquidity
Sourcepub fn bid_size(&self, n_levels: usize) -> Quantity
pub fn bid_size(&self, n_levels: usize) -> Quantity
Get the bid size for the first N price levels
Sourcepub fn ask_size(&self, n_levels: usize) -> Quantity
pub fn ask_size(&self, n_levels: usize) -> Quantity
Get the ask size for the first N price levels
Sourcepub fn is_thin_book(&self, threshold: Quantity, n_levels: usize) -> bool
pub fn is_thin_book(&self, threshold: Quantity, n_levels: usize) -> bool
Check if the order book is thin at the given threshold and number of levels
Sourcepub fn order_book_imbalance(&self, n_levels: usize) -> f64
pub fn order_book_imbalance(&self, n_levels: usize) -> f64
Calculate the order book imbalance ratio for the top N levels
Sourcepub fn depth_statistics(&self, side: Side, n_levels: usize) -> DepthStatistics
pub fn depth_statistics(&self, side: Side, n_levels: usize) -> DepthStatistics
Compute the depth statistics of price levels (0 n_levels means all levels)
Source§impl LimitBook
impl LimitBook
Sourcepub fn orders(&self) -> &HashMap<OrderId, RestingLimitOrder>
pub fn orders(&self) -> &HashMap<OrderId, RestingLimitOrder>
Get the limit orders indexed by order ID
Sourcepub fn levels(&self) -> &Slab<PriceLevel>
pub fn levels(&self) -> &Slab<PriceLevel>
Get the price levels
Sourcepub fn expiration_queue(&self) -> &BinaryHeap<Reverse<(Timestamp, OrderId)>>
pub fn expiration_queue(&self) -> &BinaryHeap<Reverse<(Timestamp, OrderId)>>
Get the queue of limit order IDs to be expired