Transform Methods, Part 1: Characteristic Functions#
The methods so far need a model that can be simulated, put on a tree or written as a differential equation. Transform methods work from a different property. For many models the distribution of the price is complicated, but its Fourier transform, the characteristic function, is simple. This is the first of two pages on transform methods. It sets out the characteristic function, the models it makes available, and one way of turning it into a price.
The characteristic function#
The characteristic function of the log price \(X_T = \ln S_T\) is
It always exists, it determines the distribution completely, and the characteristic function of a sum of independent variables is the product of their functions. That last property is why it is easy to write for a process with independent increments, such as a Lévy process, and for affine models such as Heston.
Black-Scholes is the simplest case. The log price is normal, with mean \(\ln S_0 + (r - \sigma^2/2)T\) and variance \(\sigma^2 T\), so
Models that have one but no density#
Black-Scholes has a closed-form price, and the models that came after it usually do not, because their density is not known. They do have a characteristic function.
Model |
What it adds to Black-Scholes |
Characteristic function |
|---|---|---|
Merton jump-diffusion |
Lognormal jumps at a Poisson rate: skew and fat tails in short maturities |
Black-Scholes term times \(\exp\left( \lambda T \left[ e^{i u m - s^2 u^2/2} - 1 \right] \right)\) |
Variance gamma |
Brownian motion on a random (gamma) clock: skew and kurtosis, with no continuous part to the volatility |
\(\left( 1 - i\theta\nu u + \tfrac{1}{2}\sigma^2\nu u^2 \right)^{-T/\nu}\) times a drift term |
Heston |
A stochastic variance that follows a CIR process, correlated with the stock: a smile that varies with maturity |
An exponential of an affine function of the current variance, from a pair of ordinary differential equations that has a closed-form solution |
For each of these the characteristic function is explicit, while the price needs a transform. Black-Scholes remains the reference, because it is the one case where the answer is known.
Two forms of the Heston function exist that are algebraically equal. The original one has a discontinuity of the complex logarithm, and it gives wrong prices for long maturities or large parameters. The version used here, the “little trap” form, avoids it. A pricer that is tested only for short maturities can have the wrong one.
From the function to a price#
The call price is the stock times the probability that the option finishes in the money under one measure, less the strike times the discounted probability under another:
Each probability is given by an inversion integral of Gil-Pelaez,
with \(\varphi(-i) = E[S_T] = S_0 e^{rT}\). The integrals are computed by numerical quadrature (Numerical Integration: Quadrature). This takes one pair of integrals for every strike, which is accurate and slow. Transform Methods, Part 2: FFT & the COS Method shows two ways of computing many strikes at once.
Two checks on any characteristic function come for free. At \(u = 0\), \(\varphi(0) = 1\), since the density integrates to one. At \(u = -i\), \(\varphi(-i) = E[S_T]\), which must be the forward \(S_0 e^{rT}\) in a risk-neutral model. The second is the martingale condition, and a model that fails it has the wrong drift.
Worked example#
The example checks the two conditions for four models, and prices a call at the strike of 100 by Gil-Pelaez inversion. Black-Scholes is checked against its closed form, Merton against its own series, and variance gamma and Heston against a Monte Carlo simulation, by exact simulation for variance gamma and by a full truncation Euler scheme for Heston.
Python code
"""Characteristic functions of the log stock price for four models, and option prices by Gil-Pelaez inversion."""
import numpy as np
from scipy.integrate import quad
from scipy.special import factorial
from common import K, R, S0, SIGMA, T, bs_price
HESTON = dict(v0=0.04, kappa=2.0, theta=0.04, xi=0.3, rho=-0.7)
MERTON = dict(sigma=0.15, lam=0.8, m=-0.10, s=0.15)
VG = dict(sigma=0.20, nu=0.25, theta=-0.15)
def cf_bs(u, t=T, sigma=SIGMA):
return np.exp(1j * u * (np.log(S0) + (R - 0.5 * sigma**2) * t) - 0.5 * sigma**2 * t * u**2)
def cf_heston(u, t=T, v0=0.04, kappa=2.0, theta=0.04, xi=0.3, rho=-0.7):
"""Heston, in the form that avoids the branch cut of the complex logarithm."""
b = kappa - rho * xi * 1j * u
d = np.sqrt(b**2 + xi**2 * (1j * u + u**2))
g = (b - d) / (b + d)
e = np.exp(-d * t)
c = R * 1j * u * t + kappa * theta / xi**2 * ((b - d) * t - 2 * np.log((1 - g * e) / (1 - g)))
dd = (b - d) / xi**2 * (1 - e) / (1 - g * e)
return np.exp(c + dd * v0 + 1j * u * np.log(S0))
def cf_merton(u, t=T, sigma=0.15, lam=0.8, m=-0.10, s=0.15):
k = np.exp(m + 0.5 * s**2) - 1
drift = np.log(S0) + (R - 0.5 * sigma**2 - lam * k) * t
return np.exp(1j * u * drift - 0.5 * sigma**2 * t * u**2 + lam * t * (np.exp(1j * u * m - 0.5 * s**2 * u**2) - 1))
def cf_vg(u, t=T, sigma=0.20, nu=0.25, theta=-0.15):
omega = np.log(1 - theta * nu - 0.5 * sigma**2 * nu) / nu
return np.exp(1j * u * (np.log(S0) + (R + omega) * t)) * (1 - 1j * theta * nu * u + 0.5 * sigma**2 * nu * u**2) ** (-t / nu)
def gil_pelaez_call(cf, strike=K, t=T, upper=400.0):
"""Call price from the characteristic function: S0 P1 - K exp(-rT) P2, each probability an integral over u."""
forward = S0 * np.exp(R * t)
p2 = 0.5 + quad(lambda u: (np.exp(-1j * u * np.log(strike)) * cf(u) / (1j * u)).real, 1e-10, upper, limit=800)[0] / np.pi
p1 = 0.5 + quad(lambda u: (np.exp(-1j * u * np.log(strike)) * cf(u - 1j) / (1j * u * forward)).real, 1e-10, upper, limit=800)[0] / np.pi
return S0 * p1 - strike * np.exp(-R * t) * p2
def merton_series(strike=K, t=T, sigma=0.15, lam=0.8, m=-0.10, s=0.15, terms=60):
"""Merton's closed form: a Poisson-weighted sum of Black-Scholes prices."""
k = np.exp(m + 0.5 * s**2) - 1
lam_p = lam * (1 + k)
total = 0.0
for n in range(terms):
weight = np.exp(-lam_p * t) * (lam_p * t) ** n / factorial(n)
total += weight * bs_price(S0, strike, R - lam * k + n * np.log(1 + k) / t, np.sqrt(sigma**2 + n * s**2 / t), t)
return total
def simulate_heston(n=200_000, steps=250, seed=3, **p):
"""Call price by Monte Carlo, with a full truncation Euler scheme for the variance."""
rng = np.random.default_rng(seed)
dt = T / steps
log_s, v = np.full(n, np.log(S0)), np.full(n, p["v0"])
for _ in range(steps):
z1 = rng.standard_normal(n)
z2 = p["rho"] * z1 + np.sqrt(1 - p["rho"] ** 2) * rng.standard_normal(n)
vp = np.maximum(v, 0)
log_s += (R - 0.5 * vp) * dt + np.sqrt(vp * dt) * z1
v += p["kappa"] * (p["theta"] - vp) * dt + p["xi"] * np.sqrt(vp * dt) * z2
pv = np.exp(-R * T) * np.maximum(np.exp(log_s) - K, 0)
return pv.mean(), pv.std(ddof=1) / np.sqrt(n)
def simulate_vg(n=2_000_000, seed=4, sigma=0.20, nu=0.25, theta=-0.15):
"""Variance gamma by exact simulation: Brownian motion with drift run on a gamma clock."""
rng = np.random.default_rng(seed)
g = rng.gamma(T / nu, nu, n)
x = theta * g + sigma * np.sqrt(g) * rng.standard_normal(n)
omega = np.log(1 - theta * nu - 0.5 * sigma**2 * nu) / nu
st = S0 * np.exp((R + omega) * T + x)
pv = np.exp(-R * T) * np.maximum(st - K, 0)
return pv.mean(), pv.std(ddof=1) / np.sqrt(n)
if __name__ == "__main__":
models = {"Black-Scholes": cf_bs, "Heston": lambda u: cf_heston(u, **HESTON),
"Merton": lambda u: cf_merton(u, **MERTON), "Variance gamma": lambda u: cf_vg(u, **VG)}
forward = S0 * np.exp(R * T)
print(f"Checks on the characteristic function phi(u) = E[exp(i u ln S_T)]. Forward S0 exp(rT) = {forward:.6f}\n")
print(f"{'Model':<16} {'phi(0)':>8} {'phi(-i), the forward':>22}")
for name, cf in models.items():
print(f"{name:<16} {abs(cf(0.0)):8.4f} {cf(-1j).real:22.6f}")
print(f"\nCall price, strike {K:.0f}, by Gil-Pelaez inversion")
print(f"{'Model':<16} {'Inversion':>10} {'Reference':>10} {'Difference':>11} Reference is")
bs_inv = gil_pelaez_call(models["Black-Scholes"])
print(f"{'Black-Scholes':<16} {bs_inv:10.6f} {bs_price():10.6f} {bs_inv - bs_price():+11.2e} closed form")
inv = gil_pelaez_call(models["Merton"])
ref = merton_series()
print(f"{'Merton':<16} {inv:10.6f} {ref:10.6f} {inv - ref:+11.2e} Poisson-weighted Black-Scholes series")
inv = gil_pelaez_call(models["Variance gamma"])
ref, se = simulate_vg()
print(f"{'Variance gamma':<16} {inv:10.6f} {ref:10.6f} {inv - ref:+11.2e} Monte Carlo, standard error {se:.4f}")
inv = gil_pelaez_call(models["Heston"])
ref, se = simulate_heston(**HESTON)
print(f"{'Heston':<16} {inv:10.6f} {ref:10.6f} {inv - ref:+11.2e} Monte Carlo, standard error {se:.4f}")
The output is:
Checks on the characteristic function phi(u) = E[exp(i u ln S_T)]. Forward S0 exp(rT) = 103.045453
Model phi(0) phi(-i), the forward
Black-Scholes 1.0000 103.045453
Heston 1.0000 103.045453
Merton 1.0000 103.045453
Variance gamma 1.0000 103.045453
Call price, strike 100, by Gil-Pelaez inversion
Model Inversion Reference Difference Reference is
Black-Scholes 9.413403 9.413403 -1.28e-10 closed form
Merton 9.803674 9.803674 -1.46e-10 Poisson-weighted Black-Scholes series
Variance gamma 9.609375 9.613584 -4.21e-03 Monte Carlo, standard error 0.0096
Heston 9.242521 9.256184 -1.37e-02 Monte Carlo, standard error 0.0260
Reading the output:
All four functions pass both checks. \(\varphi(0) = 1\), and \(\varphi(-i)\) equals the forward, 103.0455, for every model. The models differ in how they spread the distribution, and not in its mean.
Where an exact reference exists, the match is to ten digits. The inversion gives 9.413403 for Black-Scholes, which is the closed form, and 9.803674 for Merton, which is the Poisson series. The difference is \(10^{-10}\), the accuracy of the integration.
Where the reference is a simulation, the match is within its noise. Variance gamma differs from the simulated price by 0.004, which is 0.4 standard errors. Heston differs by 0.014, which is 0.5 standard errors. The Fourier price is the more accurate of the two numbers, since the simulation has a standard error of 0.01 to 0.03 and the Heston scheme also has a discretisation bias.
The models give different prices for the same strike. The jump model is worth 9.80 against 9.41 for Black-Scholes, variance gamma 9.61 and Heston 9.24, although they have the same forward. The model, and not the numerical method, accounts for the difference.
A valuation control view#
Test the characteristic function itself: \(\varphi(0) = 1\), and \(\varphi(-i)\) equals the forward. They take no time, and they catch a wrong sign, a missing drift term and a missing convexity correction.
Use an independent reference for each model: a closed form where one exists, as for Black-Scholes and Merton, and a Monte Carlo with its standard error where not. A Fourier price that disagrees with a simulation by more than the combined noise is wrong.
Know the formulation: the branch cut in the Heston function is a documented source of error for long maturities. A model review should include a test for a long maturity and for high volatility of volatility.
Check the integration: the upper limit of the integral and the quadrature tolerance. The integrand decays more slowly for short maturities and for models with jumps, and a cut-off that is fine for one year can be wrong for one week.
Remember the limits of the method: it prices European payoffs only. A barrier or an American feature needs another method, or a transform method applied to a more complicated problem.
Next, Transform Methods, Part 2: FFT & the COS Method shows how to price many strikes at once.