Trait OrderbookAnalytics

Source
pub trait OrderbookAnalytics {
    // Required methods
    fn calculate_market_impact(
        &self,
        notional_amount: f64,
        side: OrderSide,
    ) -> f64;
    fn get_spread_percent(&self) -> f64;
    fn get_effective_price(&self, quantity: f64, side: OrderSide) -> Option<f64>;
    fn get_imbalance(&self, levels: usize) -> f64;
    fn calculate_liquidity(
        &self,
        price_range_percent: f64,
        side: OrderSide,
    ) -> f64;
    fn find_resistance_levels(
        &self,
        min_volume: f64,
        side: OrderSide,
    ) -> SmallVec<[(f64, f64); 8]>;
    fn weighted_mid_price(&self, depth_levels: usize) -> Option<f64>;
    fn stability_score(&self) -> f64;
    fn market_pressure(&self) -> f64;
}
Expand description

Advanced orderbook analytics for HFT applications

Required Methods§

Source

fn calculate_market_impact(&self, notional_amount: f64, side: OrderSide) -> f64

Calculate market impact for a given notional amount Returns the estimated price impact as a percentage

Source

fn get_spread_percent(&self) -> f64

Get spread as a percentage of mid price

Source

fn get_effective_price(&self, quantity: f64, side: OrderSide) -> Option<f64>

Get the effective price for a given quantity Returns the volume-weighted average execution price

Source

fn get_imbalance(&self, levels: usize) -> f64

Get orderbook imbalance metric Returns a value between -1.0 (all asks) and 1.0 (all bids)

Source

fn calculate_liquidity(&self, price_range_percent: f64, side: OrderSide) -> f64

Calculate liquidity at specified price levels Returns total volume available within the price range

Source

fn find_resistance_levels( &self, min_volume: f64, side: OrderSide, ) -> SmallVec<[(f64, f64); 8]>

Calculate order book resistance levels Returns price levels with significant volume

Source

fn weighted_mid_price(&self, depth_levels: usize) -> Option<f64>

Calculate weighted mid price based on volume Returns a more accurate mid price weighted by volume at each level

Source

fn stability_score(&self) -> f64

Calculate stability of the orderbook Returns a stability score between 0.0 (unstable) and 1.0 (stable)

Source

fn market_pressure(&self) -> f64

Calculate market pressure indicator Returns a value between -1.0 (sell pressure) and 1.0 (buy pressure)

Implementors§