Class MarketQualityMetrics

java.lang.Object
com.quantfinlib.regulatory.MarketQualityMetrics

public final class MarketQualityMetrics extends Object
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 Type
    Method
    Description
    static double
    effectiveSpreadBps(Side takerSide, double price, double midAtExecution)
    Effective spread: 2 * sign * (price - mid) / mid — what the taker actually paid.
    static double
    orderToTradeRatio(long messages, long trades)
    Messages (orders + cancels + replaces) per executed trade.
    static double
    priceImpactBps(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 double
    quotedSpreadBps(double bid, double ask)
     
    static double
    realizedSpreadBps(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • quotedSpreadBps

      public static double quotedSpreadBps(double bid, double ask)
    • effectiveSpreadBps

      public static double effectiveSpreadBps(Side takerSide, double price, double midAtExecution)
      Effective spread: 2 * sign * (price - mid) / mid — what the taker actually paid.
    • realizedSpreadBps

      public static double realizedSpreadBps(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.
    • priceImpactBps

      public static double priceImpactBps(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.
    • orderToTradeRatio

      public static double orderToTradeRatio(long messages, long trades)
      Messages (orders + cancels + replaces) per executed trade.