stochvolmodels

Author: Artur Sepp / First recorded: 2026-08-16

Implemented in stochvolmodels. Software citation: CITATION.cff.

stochvolmodels is a Python library for pricing European options under stochastic volatility. It prices vanilla, inverse and quadratic-variance options by Fourier inversion of a closed-form moment generating function, checks the analytic prices against a Monte Carlo simulation of the same dynamics, and calibrates the models to option chains. It is the reference implementation of the log-normal stochastic volatility model with quadratic drift, with the Heston model as benchmark. Its core depends on no sibling package other than vanilla-option-pricers.

The provisional stochvolmodels.pde_solvers module provides PDE1DSolver and PDE2DADISolver for evolving option values backward or densities forward. The 2.21.0.dev7 source checkout also supports partial integro-differential equations (PIDEs) with exponential jumps. The two-name example computes the probability that both names stay above their default barriers under shared and individual jumps. Two-name survival example · Exponential-jump API

To price a chain of European calls and puts under the money-market measure, use the opt-in LogSvPdePricer. Solver guide · LogSV PDE pricing · Local volatility and LSV · API reference

Start here

  1. Install stochvolmodels and price a first option. The core installation command is python -m pip install stochvolmodels, and the first example runs offline.

  2. Keep the notation and conventions at hand: the paper symbols mapped to code, units, option types, the MMA and inverse measures, the option-chain layout, Monte Carlo seeds and the stability tiers are defined there once for every page.

  3. Browse the analytics gallery for every figure with its question, data and producer, or the examples and recipes for every runnable script, its data requirements and the page it supports.

The model in one picture

Under the money-market-account measure, the log-normal stochastic volatility model of Sepp and Rakhmonov (2023, Eq. (3.12)) drives the spot price \(S_t\) with a volatility \(\sigma_t\) that mean reverts with a quadratic drift:

\[dS_t = r(t) S_t dt + \sigma_t S_t dW^{(0)}_t ,\]
\[d\sigma_t = (\kappa_1 + \kappa_2 \sigma_t)(\theta - \sigma_t) dt + \beta \sigma_t dW^{(0)}_t + \varepsilon \sigma_t dW^{(1)}_t .\]

The volatility beta \(\beta\) sets the sign of the return-volatility correlation, and the quadratic term \(\kappa_2\) permits a positive \(\beta\) without losing the martingale property, provided \(\kappa_2 \ge \beta\). Options are priced by inverting the moment generating function (MGF) of the log price, which an affine expansion gives in closed form up to a system of ordinary differential equations.

        flowchart TB
    P["Model parameters"] --> D["Volatility dynamics"]
    D --> M["MGF by affine expansion"]
    M --> F["Fourier inversion"]
    D --> S["Monte Carlo simulation"]
    F --> V["Prices and implied volatilities"]
    S -- "independent check" --> V
    C["Market option chain"] --> K["Calibration"]
    V --> K
    K -- "fitted parameters" --> P
    

In words: parameters define the volatility dynamics; the affine expansion turns the dynamics into an MGF; Fourier inversion turns the MGF into prices and implied volatilities; a Monte Carlo simulation of the same dynamics checks those prices independently; and calibration fits the parameters to the implied volatilities of a market chain.

The log-normal SV model

Transform pricing

Simulation and validation

  • Monte Carlo simulation schemes: the log-volatility scheme of the paper and the explicit scheme of the package, strong and weak convergence, sampling error, fixed random numbers and historical rough functions.

  • Experimental rough-logSV pricing: the standalone model, complete factor history, bounded conditional controls, raw-forward diagnostics and selected-case replay.

  • Analytic versus Monte Carlo validation: what agreement between the transform price and the simulated price establishes, and where on the Bitcoin chain the two separate.

Calibration

Other models

  • The Heston model as a benchmark: the square-root variance model and its closed-form MGF, the Feller condition, and how it differs from the log-normal SV model in the distribution of volatility, in smiles and in a fit.

  • Jump-diffusion with clustered jumps: positive and negative jumps whose intensities are self- and cross-exciting Hawkes processes, priced from an affine MGF (advanced).

  • Gaussian-mixture and Student-t smiles: terminal laws of one maturity, a mixture of normal log-returns and a Student-t simple return, with closed-form prices and no dynamics.

  • Stochastic volatility for factor HJM rates: Nelson-Siegel yield-curve factors with one log-normal volatility driver, swaption smiles by drift freezing and the affine expansion, checked by simulation (experimental).

Applications

Case studies report the evidence of the research papers, or apply the package to bundled data, in context: the study design, the configuration, the exhibits, and what the study does and does not show.

Implementation and reference

Research papers

The methods are published in two papers whose article PDF and LaTeX source are in the repository, under papers/:

  • Sepp, A. and Rakhmonov, P. (2023). Log-normal stochastic volatility model with quadratic drift. International Journal of Theoretical and Applied Finance 26(8), 2450003. DOI 10.1142/S0219024924500031.

  • Sepp, A. and Rakhmonov, P. (2025). Stochastic volatility for factor Heath-Jarrow-Morton framework. Review of Derivatives Research 28, article 12. DOI 10.1007/s11147-025-09217-4.

Further working papers that use the package are listed in research papers and replication.

Project resources