Class MarketQualityMetrics
java.lang.Object
com.quantfinlib.regulatory.MarketQualityMetrics
Market quality indices used in execution-quality and venue-quality
reporting: quoted / effective / realized spread, price impact, and
order-to-trade ratio. All spreads in basis points; signs follow the
convention that positive = cost to the liquidity taker.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleeffectiveSpreadBps(Side takerSide, double price, double midAtExecution) Effective spread:2 * sign * (price - mid) / mid— what the taker actually paid.static doubleorderToTradeRatio(long messages, long trades) Messages (orders + cancels + replaces) per executed trade.static doublepriceImpactBps(Side takerSide, double midAtExecution, double midAfterHorizon) Price impact: how far the mid moved in the taker's direction after the trade (2 * sign * (midAfter - midAtExec) / midAtExec); effective spread ≈ realized spread + price impact.static doublequotedSpreadBps(double bid, double ask) static doublerealizedSpreadBps(Side takerSide, double price, double midAfterHorizon) Realized spread: effective spread measured against the mid some horizon after the trade — the part of the spread the liquidity provider kept after adverse selection.
-
Method Details
-
quotedSpreadBps
public static double quotedSpreadBps(double bid, double ask) -
effectiveSpreadBps
Effective spread:2 * sign * (price - mid) / mid— what the taker actually paid. -
realizedSpreadBps
Realized spread: effective spread measured against the mid some horizon after the trade — the part of the spread the liquidity provider kept after adverse selection. -
priceImpactBps
Price impact: how far the mid moved in the taker's direction after the trade (2 * sign * (midAfter - midAtExec) / midAtExec); effective spread ≈ realized spread + price impact. -
orderToTradeRatio
public static double orderToTradeRatio(long messages, long trades) Messages (orders + cancels + replaces) per executed trade.
-