Skip to main content

RPIOrderbookLevel

Struct RPIOrderbookLevel 

Source
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: f64

The price level.

§non_rpi_size: f64

The 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: f64

The 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

Source

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.

Source

pub fn total_size(&self) -> f64

Returns the total size (non-RPI + RPI) at this price level.

Source

pub fn has_rpi(&self) -> bool

Returns true if this level has any RPI size.

Source

pub fn has_non_rpi(&self) -> bool

Returns true if this level has any non-RPI size.

Source

pub fn notional_value(&self) -> f64

Returns the notional value (price × total size).

Source

pub fn rpi_ratio(&self) -> f64

Returns the RPI ratio (RPI size / total size).

Source

pub fn non_rpi_ratio(&self) -> f64

Returns the non-RPI ratio (non-RPI size / total size).

Source

pub fn effective_taker_price(&self, is_buy: bool) -> f64

Returns the effective price for takers (considering RPI improvement).

Source

pub fn price_impact(&self, reference_price: f64) -> f64

Returns the price impact if this level were consumed.

Source

pub fn provides_price_improvement( &self, reference_price: f64, is_buy: bool, ) -> bool

Returns whether this level provides price improvement over a reference price.

Source

pub fn improvement_amount(&self, reference_price: f64, is_buy: bool) -> f64

Returns the improvement amount over a reference price.

Source

pub fn improvement_percentage(&self, reference_price: f64, is_buy: bool) -> f64

Returns the improvement percentage over a reference price.

Source

pub fn scaled(&self, factor: f64) -> Self

Returns a scaled version of this level.

Source

pub fn is_valid(&self) -> bool

Returns whether this level is valid (positive price and at least one size > 0).

Source

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

Source§

fn clone(&self) -> RPIOrderbookLevel

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RPIOrderbookLevel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RPIOrderbookLevel

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RPIOrderbookLevel

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,