Class Heston

java.lang.Object
com.quantfinlib.pricing.Heston

public final class Heston extends Object
Heston (1993) stochastic-volatility pricing — the canonical answer to Black-Scholes' one visible lie, the flat smile. Variance follows its own mean-reverting square-root process, correlated with spot:
  dS = (r−q)S dt + √v S dW₁
  dv = κ(θ − v) dt + σᵥ √v dW₂,   d⟨W₁,W₂⟩ = ρ dt
so the model PRODUCES a smile: ρ < 0 tilts it (equity skew — spot down, vol up), σᵥ fattens the wings, κ/θ set how fast and where variance mean-reverts.

Pricing is semi-analytic: the European call is two probabilities recovered from the model's characteristic function by numerical integration. This implementation uses the "little Heston trap" formulation (Albrecher et al. 2007), which is numerically stable for long maturities where the original 1993 branch-cut form explodes, and fixed-step Simpson integration on a damped integrand — deterministic, allocation-light, and accurate to well past test tolerance for practical parameter ranges.

Honesty notes: the Feller condition 2κθ ≥ σᵥ² keeps the variance strictly positive; parameters violating it are accepted (markets calibrate there constantly) but the Monte Carlo cross-check in the tests uses full-truncation Euler for exactly that reason. No calibration is shipped — calibrating five parameters to a vol surface is an optimization-layer exercise (optimization package tools apply); this class prices given parameters. Research lane.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Model parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    call(double spot, double strike, double rate, double divYield, double timeYears, Heston.Params p)
    European call under Heston (semi-analytic).
    static double
    callMonteCarlo(double spot, double strike, double rate, double divYield, double timeYears, Heston.Params p, int steps, int paths, long seed)
    Full-truncation Euler Monte Carlo — the pricing cross-check (used by the tests to validate the semi-analytic integral, and usable for payoffs the closed form cannot reach).
    static double
    put(double spot, double strike, double rate, double divYield, double timeYears, Heston.Params p)
    European put via put-call parity.

    Methods inherited from class java.lang.Object

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

    • call

      public static double call(double spot, double strike, double rate, double divYield, double timeYears, Heston.Params p)
      European call under Heston (semi-analytic).
    • put

      public static double put(double spot, double strike, double rate, double divYield, double timeYears, Heston.Params p)
      European put via put-call parity.
    • callMonteCarlo

      public static double callMonteCarlo(double spot, double strike, double rate, double divYield, double timeYears, Heston.Params p, int steps, int paths, long seed)
      Full-truncation Euler Monte Carlo — the pricing cross-check (used by the tests to validate the semi-analytic integral, and usable for payoffs the closed form cannot reach). Deterministic per seed.