Skip to main content

compute_kyle_lambda

Function compute_kyle_lambda 

Source
pub fn compute_kyle_lambda(lookback: &[&TradeSnapshot]) -> f64
Expand description

Compute Kyle’s Lambda (normalized version) with adaptive sampling for large windows

Formula: lambda = ((price_end - price_start) / price_start) / ((buy_vol - sell_vol) / total_vol)

Reference: Kyle (1985), Hasbrouck (2009)

Interpretation:

  • lambda > 0: Price moves in direction of order flow (normal)
  • lambda < 0: Price moves against order flow (unusual)
  • |lambda| high: Large price impact per unit imbalance (illiquid)

Optimization (Issue #96 Task #52): Adaptive computation

  • Small windows (n < 10): Return 0.0 early (insufficient signal for Kyle Lambda)
  • Large windows (n > 500): Subsample every 5th trade (preserves signal, 5-7x speedup)
  • Medium windows (10-500): Full computation

§SIMD Implementation

Issue #96 Task #148 Phase 2: Kyle Lambda SIMD acceleration (1.5-2.5x speedup) Dispatch to SIMD or scalar based on feature flag Issue #96 Task #52: #[inline] for thin SIMD/scalar dispatcher