pub struct RPIOrderbookLevel {
pub price: f64,
pub non_rpi_size: f64,
pub rpi_size: f64,
}Expand description
Represents a single RPI (Real-time Price Improvement) order book level.
Each level contains the price, non-RPI size, and RPI size for either bids or asks. RPI orders are special orders that can improve prices for takers.
Fields§
§price: f64The price level.
non_rpi_size: f64The non-RPI size at this price level.
This represents the regular order quantity at this price. When delta data has size=0, it means all quotations for this price have been filled or cancelled.
rpi_size: f64The RPI size at this price level.
This represents the RPI (Real-time Price Improvement) order quantity at this price. When a bid RPI order crosses with a non-RPI ask price, the quantity of the bid RPI becomes invalid and is hidden. When an ask RPI order crosses with a non-RPI bid price, the quantity of the ask RPI becomes invalid and is hidden.
Implementations§
Source§impl RPIOrderbookLevel
impl RPIOrderbookLevel
Sourcepub fn new(price: f64, non_rpi_size: f64, rpi_size: f64) -> Self
pub fn new(price: f64, non_rpi_size: f64, rpi_size: f64) -> Self
Constructs a new RPIOrderbookLevel with specified price, non-RPI size, and RPI size.
Sourcepub fn total_size(&self) -> f64
pub fn total_size(&self) -> f64
Returns the total size (non-RPI + RPI) at this price level.
Sourcepub fn has_non_rpi(&self) -> bool
pub fn has_non_rpi(&self) -> bool
Returns true if this level has any non-RPI size.
Sourcepub fn notional_value(&self) -> f64
pub fn notional_value(&self) -> f64
Returns the notional value (price × total size).
Sourcepub fn non_rpi_ratio(&self) -> f64
pub fn non_rpi_ratio(&self) -> f64
Returns the non-RPI ratio (non-RPI size / total size).
Sourcepub fn effective_taker_price(&self, is_buy: bool) -> f64
pub fn effective_taker_price(&self, is_buy: bool) -> f64
Returns the effective price for takers (considering RPI improvement).
Sourcepub fn price_impact(&self, reference_price: f64) -> f64
pub fn price_impact(&self, reference_price: f64) -> f64
Returns the price impact if this level were consumed.
Sourcepub fn provides_price_improvement(
&self,
reference_price: f64,
is_buy: bool,
) -> bool
pub fn provides_price_improvement( &self, reference_price: f64, is_buy: bool, ) -> bool
Returns whether this level provides price improvement over a reference price.
Sourcepub fn improvement_amount(&self, reference_price: f64, is_buy: bool) -> f64
pub fn improvement_amount(&self, reference_price: f64, is_buy: bool) -> f64
Returns the improvement amount over a reference price.
Sourcepub fn improvement_percentage(&self, reference_price: f64, is_buy: bool) -> f64
pub fn improvement_percentage(&self, reference_price: f64, is_buy: bool) -> f64
Returns the improvement percentage over a reference price.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns whether this level is valid (positive price and at least one size > 0).
Sourcepub fn weighted_price_with_rpi_probability(
&self,
rpi_execution_probability: f64,
) -> f64
pub fn weighted_price_with_rpi_probability( &self, rpi_execution_probability: f64, ) -> f64
Returns the weighted average price considering RPI probability.
Trait Implementations§
Source§impl Clone for RPIOrderbookLevel
impl Clone for RPIOrderbookLevel
Source§fn clone(&self) -> RPIOrderbookLevel
fn clone(&self) -> RPIOrderbookLevel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more