Uses of Package
com.quantfinlib.microstructure

Package
Description
Bar-based backtesting.
Event-driven tick-level backtesting — the level below bars, where queue position decides whether a passive order actually trades: TickBacktester replays QFLT tick files through a TickStrategy with microstructure-aware fills (market orders pay half the spread; limit orders fill on trade-through or earn fills print-by-print against a simulated queue; optional tick-size grid for real-world prices; no fills against the triggering print).
Execution strategy support: SmartOrderRouter (fee-adjusted multi-venue splitting, dark-first option), its zero-allocation hot-lane sibling HftSor, and the full-checklist AdaptiveSor (expected-cost routing over displayed + hidden liquidity, fees/rebates, latency, fill probability and a reliability veto, with contingent dark probes) learning from VenueScorecard (streaming per-venue fill rate, measured latency, realized dark fills), TwapScheduler / VwapScheduler (schedule design with anti-gaming jitter and exact largest-remainder allocation), PovTracker (streaming percentage-of-volume participation), ImplementationShortfallScheduler (Almgren-Chriss-optimal slicing), WmrFixingScheduler (benchmark-window TWAP replication), BenchmarkExecutor (the DYNAMIC benchmark algo: one stateful executor tracking VWAP / TWAP / Arrival / Implementation Shortfall / Closing / Opening / Participation, re-deciding each interval from live spread, depth, volatility, volume curve, alpha and liquidity — cross-asset), LiquiditySeekingAlgo (the opportunistic archetype: burst when the spread is under its time-of-day forecast in a calm regime, guaranteed by a completion floor over the final stretch), PortfolioExecutor (multi-symbol portfolio-level scheduling over per-symbol BenchmarkExecutor children: leg-balance band for two-sided transitions, per-interval notional budget allocated risk-weighted — overlays only ever damp a child's own due, so per-symbol benchmark integrity holds), IcebergOrder (display/reload state machine), DarkPoolSimulator (midpoint cross with minimum-execution-quantity), MidPegTracker (peg repricing with thresholds) and VenueBenchmark (fill rate, effective spread, markout per venue).
Market microstructure analytics: MarketImpactModel (square-root law + Almgren-Chriss temporary/permanent decomposition), AlmgrenChriss (closed-form optimal execution trajectories on the cost/risk frontier), QueueModel (fill probability from queue position and latency advantage), TransactionCostAnalyzer (implementation shortfall, slippage vs VWAP, effective spread per fill), TickSizeSchedule (banded price grids) and Auction (call uncross).
Order entry, two lanes (mirroring marketdata):
  • Class
    Description
    A matched trade (fill) for TCA and venue analytics.
     
  • Class
    Description
    A matched trade (fill) for TCA and venue analytics.
    Price-banded tick sizes — the MiFID II / ESMA RTS 11 regime where the minimum price increment depends on the instrument's price (and liquidity band), rather than being one flat number.
  • Class
    Description
     
    Streaming EWMA covariance matrix — the multi-asset risk picture that single-symbol volatility cannot see.
  • Class
    Description
     
    The optimal schedule: holdings[j] is the position after interval j (holdings[0] = X, holdings[N] = 0); trades[j] is sold in interval j+1.
    A call auction (open/close/volatility uncross): orders accumulate without trading, then a single clearing price executes the maximum matchable volume — the mechanism behind exchange opens, the close every benchmark-tracking strategy trades, and LULD/volatility-halt reopenings.
    Auction outcome: clearing price, matched volume, and leftover imbalance.
    MWCB halt decision.
    LULD per-symbol state.
    A matched trade (fill) for TCA and venue analytics.
    Temporary / permanent market impact models for large trades, parameterized by average daily volume (ADV) and daily volatility: Square-root law (empirical standard): impact = Y * sigma_daily * sqrt(Q / ADV). Almgren-Chriss style decomposition: linear temporary impact in participation rate and linear permanent impact in size, with the expected cost of an execution schedule E[cost] = permanent/2 + temporary. All results in basis points of the arrival price.
     
    The unified streaming signal engine: one multi-symbol, hot-lane component that turns raw top-of-book quotes and trade prints into the five signal families a trading decision reads — for equities and FX alike (prices are doubles; equity integer ticks are exact in a double, FX rates feed in directly): Imbalance — order-flow imbalance (Cont-Kukanov-Stoikov, time-decayed), inside queue imbalance and signed trade-flow imbalance, via a per-symbol FlowSignals; Fair value — the size-weighted microprice (FairValueEngine.microprice); Volatility — a streaming EWMA realized-variance rate over irregular tick arrivals: per valid mid change, r² / dt enters a time-decayed average, and SignalEngine.volPerSqrtSecond(int) is its square root — multiply by √(seconds per year) to annualize externally; Liquidity — time-decayed EWMAs of the absolute spread (and SignalEngine.spreadBps(int) of mid), displayed top-of-book depth, and quote arrival intensity (from the decayed inter-quote gap); Momentum — two time-aware EMAs of the mid (decay by elapsed time, not by update count — constant-step EMAs like indicators.StreamingIndicators mis-weight irregular tick arrivals), read as the normalized fast/slow gap (fast − slow)/mid.
    Half-lives (all in nanos) for the decayed estimators, plus the composite weights.
    Short-term spread prediction.
    Price-banded tick sizes — the MiFID II / ESMA RTS 11 regime where the minimum price increment depends on the instrument's price (and liquidity band), rather than being one flat number.
    Accumulates (floor price, tick) bands; floors may arrive in any order.
     
     
    Intraday volatility seasonality — the third leg of the seasonality trio beside VolumeCurve and SpreadForecaster: volatility is U-shaped through an equity day (wild open, quiet lunch, busy close) and session-humped through an FX day (London open, NY overlap), so "is the market volatile right now?"
    Dynamic intraday volume prediction — the model that makes a VWAP schedule live instead of historical.
  • Class
    Description
    Price-banded tick sizes — the MiFID II / ESMA RTS 11 regime where the minimum price increment depends on the instrument's price (and liquidity band), rather than being one flat number.