Class PreTradeLimitChecker

java.lang.Object
com.quantfinlib.risk.PreTradeLimitChecker

public final class PreTradeLimitChecker extends Object
Pre-trade risk gate: validates every order against configured limits before it reaches the market — order size, notional, resulting position, price collar versus a reference mid, restricted symbols, and counterparty credit headroom. Designed to be evaluated synchronously on the order path.
  • Constructor Details

    • PreTradeLimitChecker

      public PreTradeLimitChecker()
  • Method Details

    • maxOrderQuantity

      public PreTradeLimitChecker maxOrderQuantity(long qty)
    • maxOrderNotional

      public PreTradeLimitChecker maxOrderNotional(double notional)
    • maxPositionQuantity

      public PreTradeLimitChecker maxPositionQuantity(long qty)
      Cap on |position| after the order would fully fill.
    • priceCollarPct

      public PreTradeLimitChecker priceCollarPct(double pct)
      Reject prices more than this fraction away from the reference mid (fat-finger guard).
    • counterpartyLimit

      public PreTradeLimitChecker counterpartyLimit(String counterparty, double limit)
    • restrictSymbol

      public PreTradeLimitChecker restrictSymbol(String symbol)
    • check

      public PreTradeLimitChecker.CheckResult check(PreTradeLimitChecker.OrderRequest order, double referenceMid, long currentPositionQty, double counterpartyExposure)
      Parameters:
      referenceMid - current market mid for the collar check (NaN skips it)
      currentPositionQty - signed current position in the symbol
      counterpartyExposure - current total exposure to the order's counterparty