Class MidPegTracker

java.lang.Object
com.quantfinlib.execution.MidPegTracker

public final class MidPegTracker extends Object
Mid-rate pegging model: tracks the target price of a mid-pegged order with an offset and optional limit cap, and decides when the peg has drifted far enough to justify a reprice (each reprice costs queue priority and a message, so small moves are ignored).
  • Constructor Details

    • MidPegTracker

      public MidPegTracker(Side side, double offset, double limitPrice, double repriceThreshold)
      Parameters:
      offset - signed offset from the mid (negative = more passive for a buy)
      limitPrice - hard cap: never price through this (NaN to disable)
      repriceThreshold - minimum absolute peg move before repricing
  • Method Details

    • onQuote

      public double onQuote(double bid, double ask)
      Feed a top-of-book update. Returns the new order price when a reprice is warranted, or NaN when the current price should be left alone.
    • currentPrice

      public double currentPrice()
      Current working price (NaN before the first quote).