Class LastLookGate

java.lang.Object
com.quantfinlib.trading.LastLookGate

public final class LastLookGate extends Object
Maker-side symmetric last-look price check — the mechanism FX liquidity providers apply to incoming deal requests, implemented the way the FX Global Code (Principle 17) says it must be: symmetric. At the end of the hold window the quoted price is compared to the current fair price, and the request is rejected when the market has moved beyond the tolerance in either direction — protecting the maker from being picked off, without free-optioning the taker (accepting only the moves that favor the maker is the asymmetric practice the Code prohibits).

This class is the decision arithmetic plus its disclosure statistics (accept/reject counts split by who the reject protected — the numbers an LP publishes and a taker's fx.LpScorecard measures from the other side). The hold window itself belongs to the caller's timer/session machinery. For the taker-side backtest model of adverse (asymmetric) last look, see backtest.LastLookExecution. Zero allocation, single writer.

  • Constructor Summary

    Constructors
    Constructor
    Description
    LastLookGate(double tolerance)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(boolean makerSells, double quotedPrice, double currentFair)
    The decision at the end of the hold: accept iff the fair price is still within tolerance of the quote.
    long
     
    long
    Rejects where the move was against the maker (the classic pick-off).
    double
    Reject fraction of all decisions (NaN before any decision).
    long
     
    long
    Rejects where the move favored the maker — a symmetric gate produces these in roughly equal measure; their absence in an LP's disclosures is the signature of asymmetric last look.

    Methods inherited from class java.lang.Object

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

    • LastLookGate

      public LastLookGate(double tolerance)
      Parameters:
      tolerance - maximum |current fair − quoted| move, in price units (e.g. 0.0001 = 1 pip on EURUSD), beyond which the request is rejected — in both directions
  • Method Details

    • accept

      public boolean accept(boolean makerSells, double quotedPrice, double currentFair)
      The decision at the end of the hold: accept iff the fair price is still within tolerance of the quote. Symmetric — the direction of the move never changes the outcome, only the statistics.
      Parameters:
      makerSells - true when the taker is buying (maker sells at the quote)
      quotedPrice - the price the maker showed
      currentFair - the maker's current fair value (e.g. composite mid)
    • accepts

      public long accepts()
    • rejects

      public long rejects()
    • makerProtectiveRejects

      public long makerProtectiveRejects()
      Rejects where the move was against the maker (the classic pick-off).
    • takerProtectiveRejects

      public long takerProtectiveRejects()
      Rejects where the move favored the maker — a symmetric gate produces these in roughly equal measure; their absence in an LP's disclosures is the signature of asymmetric last look.
    • rejectRate

      public double rejectRate()
      Reject fraction of all decisions (NaN before any decision).