Examples#

This gallery walks through every public feature of financialkit.stochastic_volatility: local volatility, stochastic volatility, jumps, Fourier pricing, smile parametrisations and Heston simulation. Each script illustrates one dated breakthrough from the history page.

See also the narrative tutorials:

Each script in this gallery is self-contained and can be run directly with python examples/stochastic_volatility/<section>/<script>.py.

Sections#

  • local_vol – Cox’s CEV model and Dupire’s local volatility.

  • jumps – Merton’s jump diffusion, the Madan-Seneta and Madan-Carr-Chang variance gamma, Bates and Kou.

  • heston – Hull and White’s mixing formula and the Heston model.

  • fourier – Carr-Madan’s FFT, Lewis’s single integral and the COS method.

  • smile – Hagan’s SABR, Gatheral’s SVI and Lee’s moment formula.

  • simulation – Andersen’s QE scheme and full-truncation Euler.

Fourier pricing#

Pricing from the characteristic function: Carr and Madan’s FFT, Lewis’s single integral and Fang and Oosterlee’s COS expansion.

Carr and Madan’s FFT

Carr and Madan's FFT

Lewis’s single-integral formula

Lewis's single-integral formula

Fang and Oosterlee’s COS method

Fang and Oosterlee's COS method

Stochastic volatility#

Volatility with its own randomness: Hull and White’s mixing formula for uncorrelated variance, and Heston’s correlated square-root model.

Hull and White’s stochastic volatility

Hull and White's stochastic volatility

The Heston model

The Heston model

Jumps#

Discontinuous prices: Merton’s jump diffusion, the variance gamma process in its symmetric and skewed forms, Bates’s jumps on top of Heston, and Kou’s double-exponential jumps.

Merton’s jump diffusion

Merton's jump diffusion

Madan and Seneta’s variance gamma

Madan and Seneta's variance gamma

Bates: jumps and stochastic volatility

Bates: jumps and stochastic volatility

Madan, Carr and Chang’s skewed variance gamma

Madan, Carr and Chang's skewed variance gamma

Kou’s double-exponential jumps

Kou's double-exponential jumps

Local volatility#

Volatility as a function of the price level and time: Cox’s constant elasticity of variance and Dupire’s formula, which reads the local volatility off a surface of option prices.

Cox’s constant elasticity of variance

Cox's constant elasticity of variance

Dupire’s local volatility

Dupire's local volatility

Simulation#

Monte Carlo for Heston when the variance can hit zero: Andersen’s quadratic-exponential scheme and the full-truncation Euler scheme.

Andersen’s quadratic-exponential scheme

Andersen's quadratic-exponential scheme

Lord, Koekkoek and van Dijk’s full truncation

Lord, Koekkoek and van Dijk's full truncation

Smile parametrisations#

Shapes for the implied volatility smile: Hagan’s SABR formula, Gatheral’s SVI, and Lee’s bound on how steep the wings can be.

Hagan’s SABR model

Hagan's SABR model

Gatheral’s SVI

Gatheral's SVI

Lee’s moment formula

Lee's moment formula

Gallery generated by Sphinx-Gallery