Class DarkPoolSimulator

java.lang.Object
com.quantfinlib.execution.DarkPoolSimulator

public final class DarkPoolSimulator extends Object
Midpoint-cross dark pool model: hidden resting orders match at the current lit-market midpoint, honoring minimum-execution-quantity constraints (a standard anti-gaming feature). No pre-trade transparency: resting interest is only observable through fills.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance; the explicit form of the default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onQuote(double bid, double ask)
    Update the lit reference mid.
    long
    Total hidden resting quantity on a side (for simulation introspection only).
    submit(Side side, long quantity, long minExecutionQty)
    Submits an order: crosses immediately against resting contra interest at the current mid (time priority), then rests the remainder.

    Methods inherited from class Object

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

    • DarkPoolSimulator

      public DarkPoolSimulator()
      Creates an instance; the explicit form of the default constructor.
  • Method Details

    • onQuote

      public void onQuote(double bid, double ask)
      Update the lit reference mid. A locked or crossed reference (bid >= ask) or a non-positive/non-finite side invalidates the mid: a real midpoint pool is prohibited from executing during a locked/crossed NBBO, so crossing pauses until a valid two-sided market returns — resting interest stays resting.
    • submit

      public List<DarkPoolSimulator.Fill> submit(Side side, long quantity, long minExecutionQty)
      Submits an order: crosses immediately against resting contra interest at the current mid (time priority), then rests the remainder. Returns the fills generated (empty if it fully rested).

      Minimum-execution-quantity is honored aggregate-first, the common pool semantics: the incoming order's MEQ is checked against the total crossable contra quantity (an order wanting 100 fills against two resting 60s), while each resting order's own MEQ still gates its individual slice.

    • restingQty

      public long restingQty(Side side)
      Total hidden resting quantity on a side (for simulation introspection only).