Class QueueModel

java.lang.Object
com.quantfinlib.microstructure.QueueModel

public final class QueueModel extends Object
Queue positioning and priority analytics: how position in the price-time queue — and small latency differences in reaching it — translate into fill probability.

Model: executed volume at a price level over a horizon is treated as exponentially distributed with mean expectedTradedQty; an order fills when cumulative executions reach the quantity ahead of it plus its own size, giving P(fill) = exp(-(qtyAhead + orderQty) / expectedTradedQty). A deliberately simple, closed-form model — calibrate expectedTradedQty from observed level turnover.

  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    fillProbability(long qtyAhead, long orderQty, double expectedTradedQty)
    Probability the order fully fills within the horizon.
    static double
    latencyFillAdvantage(long qtyAhead, long orderQty, double expectedTradedQty, double joinRateQtyPerSec, long latencyAdvantageNanos)
    Fill-probability edge from being latencyAdvantageNanos faster to the queue: P(fill | fast arrival) - P(fill | slow arrival).
    static double
    queueGrowth(double joinRateQtyPerSec, long latencyNanos)
    Extra quantity that joins the queue ahead of an order arriving latencyNanos later, given the rate at which others join.

    Methods inherited from class java.lang.Object

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

    • fillProbability

      public static double fillProbability(long qtyAhead, long orderQty, double expectedTradedQty)
      Probability the order fully fills within the horizon.
      Parameters:
      qtyAhead - resting quantity ahead in the queue (see OrderBook.qtyAhead)
      orderQty - our order size
      expectedTradedQty - expected volume to execute at this level over the horizon
    • queueGrowth

      public static double queueGrowth(double joinRateQtyPerSec, long latencyNanos)
      Extra quantity that joins the queue ahead of an order arriving latencyNanos later, given the rate at which others join.
    • latencyFillAdvantage

      public static double latencyFillAdvantage(long qtyAhead, long orderQty, double expectedTradedQty, double joinRateQtyPerSec, long latencyAdvantageNanos)
      Fill-probability edge from being latencyAdvantageNanos faster to the queue: P(fill | fast arrival) - P(fill | slow arrival).