Setup
Why Stochastic Volatility?
The Black-Scholes model assumes constant volatility. The market implied volatility surface is demonstrably not flat — it exhibits the volatility smile (a U-shape) and a downward skew for equity index options. These shapes cannot be reproduced by any constant-volatility model.
Two model families address this:
-
Local volatility (Dupire): . Fits the surface exactly but produces a term structure of skew that flattens too fast — the model forward smile is too flat relative to observed dynamics.
-
Stochastic volatility: the volatility itself is a random process with its own SDE. The correlation between the asset and vol processes generates skew that persists across maturities.
The Heston (1993) model is the industry benchmark stochastic vol model. Under the risk-neutral measure:
Parameters:
- : initial variance (not volatility — note is the initial vol)
- : mean-reversion speed
- : long-run variance
- : volatility of variance (vol-of-vol)
- : correlation between spot and vol shocks; negative for equity (larger moves down are associated with vol spikes)
Conventions:
- : continuously compounded risk-free rate, annualised.
- : time to expiry in years.
- Volatility parameters in decimal (not percent).
Theory
1. The Feller Condition
The CIR variance process can hit zero. Whether it stays at zero or bounces off depends on the Feller condition:
When the Feller condition is violated (), the process can reach zero and the square root is undefined during simulation. This is not merely numerical — it reflects model instability. On a derivatives desk, parameters are routinely calibrated to surfaces that violate Feller; the simulation scheme must handle this gracefully.
2. Characteristic Function Pricing (Lewis Formula)
The Heston model has a known characteristic function for :
where (using the Albrecher et al. 2007 numerically stable formulation):
The Lewis (2001) formula prices a European call using a single real-valued integral:
The integrand is smooth and rapidly decaying; standard Gauss-Legendre quadrature on with and points gives machine precision.
The stable branch selection (Albrecher 2007 vs. the original Heston 1993 formulation) matters critically: the original formulation has a branch-cut discontinuity in the complex logarithm that causes pricing errors for long maturities or extreme parameters. Always use the Albrecher formulation.
3. Monte Carlo Simulation
For path-dependent products (barriers, Asians) that the Fourier method cannot price analytically, Monte Carlo is required. The variance process must be discretised carefully.
Full truncation Euler (Lord et al. 2010): where and .
The asset step uses the current (potentially zero-floored) variance:
where with independent of .
The log-Euler scheme for avoids negative asset prices without any flooring. The correlation between and is exactly .
Variance reduction — control variate: use the Black-Scholes price with current spot vol as a control. This reduces standard error by 80-95% near at-the-money.
Implementation
HestonModel.h
#pragma once
#include <complex>
// Heston model parameters
struct HestonParams {
double V0; // Initial variance (vol = sqrt(V0))
double kappa; // Mean reversion speed
double theta; // Long-run variance
double xi; // Vol of variance (vol-of-vol)
double rho; // Spot-vol correlation
// Returns true if the Feller condition 2*kappa*theta > xi^2 is satisfied
bool feller_satisfied() const {
return 2.0 * kappa * theta > xi * xi;
}
};
// Computes European call/put price via Lewis (2001) formula
// using the Albrecher et al. (2007) numerically stable characteristic function.
double heston_call_price(double S0, double K, double r, double T,
const HestonParams& p);
double heston_put_price(double S0, double K, double r, double T,
const HestonParams& p);