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§
Sourcefn calculate_market_impact(&self, notional_amount: f64, side: OrderSide) -> f64
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
Sourcefn get_spread_percent(&self) -> f64
fn get_spread_percent(&self) -> f64
Get spread as a percentage of mid price
Sourcefn get_effective_price(&self, quantity: f64, side: OrderSide) -> Option<f64>
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
Sourcefn get_imbalance(&self, levels: usize) -> f64
fn get_imbalance(&self, levels: usize) -> f64
Get orderbook imbalance metric Returns a value between -1.0 (all asks) and 1.0 (all bids)
Sourcefn calculate_liquidity(&self, price_range_percent: f64, side: OrderSide) -> f64
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
Sourcefn find_resistance_levels(
&self,
min_volume: f64,
side: OrderSide,
) -> SmallVec<[(f64, f64); 8]>
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
Sourcefn weighted_mid_price(&self, depth_levels: usize) -> Option<f64>
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
Sourcefn stability_score(&self) -> f64
fn stability_score(&self) -> f64
Calculate stability of the orderbook Returns a stability score between 0.0 (unstable) and 1.0 (stable)
Sourcefn market_pressure(&self) -> f64
fn market_pressure(&self) -> f64
Calculate market pressure indicator Returns a value between -1.0 (sell pressure) and 1.0 (buy pressure)