Class MarketImpactPredictor

java.lang.Object
com.quantfinlib.ml.MarketImpactPredictor

public final class MarketImpactPredictor extends Object
ML market impact prediction: learns realized impact (bps) from order and book features using gradient-boosted trees, and estimates the probability a marketable order sweeps through the visible top of book.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    features(double sizeVsAdv, double spreadBps, double bookImbalance, double volatility)
    Standard feature vector.
    fit(double[][] x, double[] realizedImpactBps)
    Trains on historical (features, realized impact bps) observations.
    double
    predictImpactBps(double[] features)
     
    static double
    sweepProbability(long orderQty, long visibleContraDepth)
    Probability a marketable order of orderQty sweeps beyond the visible contra depth at the touch: logistic in the size/depth ratio, 0.5 exactly when the order equals the visible depth.

    Methods inherited from class java.lang.Object

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

    • MarketImpactPredictor

      public MarketImpactPredictor()
  • Method Details

    • features

      public static double[] features(double sizeVsAdv, double spreadBps, double bookImbalance, double volatility)
      Standard feature vector.
      Parameters:
      sizeVsAdv - order size / average daily volume
      spreadBps - quoted spread in bps at arrival
      bookImbalance - depth imbalance in [-1, 1] (signed toward the order side)
      volatility - recent per-period volatility
    • fit

      public MarketImpactPredictor fit(double[][] x, double[] realizedImpactBps)
      Trains on historical (features, realized impact bps) observations.
    • predictImpactBps

      public double predictImpactBps(double[] features)
    • sweepProbability

      public static double sweepProbability(long orderQty, long visibleContraDepth)
      Probability a marketable order of orderQty sweeps beyond the visible contra depth at the touch: logistic in the size/depth ratio, 0.5 exactly when the order equals the visible depth.