Class HedgingSimulator

java.lang.Object
com.quantfinlib.hedging.HedgingSimulator

public final class HedgingSimulator extends Object
Monte Carlo delta-hedging engine: runs DeltaHedger across thousands of GBM paths in parallel to produce the full hedging-error distribution — replication error, tail risk (hedging VaR/CVaR), and cost/rebalance statistics.

Pricing/hedging volatility and realized (path) volatility are separate inputs, so the two classic questions are directly answerable:

  • Discretization risk — hedge vol = realized vol: how does the error distribution shrink with rebalancing frequency and band?
  • Vol mispricing — hedge vol ≠ realized vol: selling rich (implied > realized) shows up as a positive mean P&L, and vice versa.
Deterministic for a given seed regardless of thread scheduling.
  • Constructor Details

    • HedgingSimulator

      public HedgingSimulator()
    • HedgingSimulator

      public HedgingSimulator(long seed)
  • Method Details

    • simulate

      public HedgingErrorDistribution simulate(BlackScholes.OptionType type, double spot, double strike, double expiryYears, double rate, double carry, double hedgeVol, double realizedVol, int stepsPerPath, int numPaths, DeltaHedger.Config hedgeConfig)
      Simulates the hedging error distribution over Monte Carlo paths.
      Parameters:
      hedgeVol - volatility used to price and delta-hedge (implied vol)
      realizedVol - volatility of the simulated underlying paths
      stepsPerPath - hedging opportunities per path (e.g. 126 for daily over 6 months)
      numPaths - Monte Carlo scenarios (2 000+ recommended)