Manual 05 Every model, one card each

Model bestiary

Every model the package simulates: its dynamics under the risk neutral measure, its constructor and parameters, how it is simulated and what it supports. How models are built and simulated (processes, engines, simulate, parameters) is in Models; this page is the catalogue.

diffusionsnormalstochastic volatilityjumpsLévylocal volatilitycopulas

At a glance

The models are written for the log return $X_t = \log(S_t / S_0)$, with $μ_t = r_t - d_t$: $r_t$ is the zero rate and $d_t$ the dividend yield of the Underlying, both constants or curves (see Market data). In every model the drift makes the discounted price, with dividends, a martingale. Every single name model works with the three samplings (standard, antithetic, Sobol), with rate and dividend curves and in the batched modes (MultiThreading, MultiProcess).

ModelFamilyParametersSchemeGPUEnzymeClosed form
BlackScholesProcessdiffusion1exacttestedyesFinancialToolbox, FinancialFFT
BachelierProcessnormal diffusion1exacttestedyesBachelier formula
HestonProcessstochastic volatility6EuleryesFinancialFFT
MertonProcessjump diffusion4exacttestedyesFinancialFFT
KouProcessjump diffusion5exacttestedyesFinancialFFT
VarianceGammaProcessinfinite activity Lévy3exacttestednoFinancialFFT
NormalInverseGaussianProcessinfinite activity Lévy3exacttestedyesFinancialFFT
LogNormalMixturelocal volatility$2n - 1$EulertestedyesFinancialCalibrator
ShiftedProcessany of the above, shiftedmodel + 1the model'stestedyesstrike shift
GaussianCopulaNVariateProcessmultivariate$ρ$ + marginalsthe models'
GaussianCopulaNVariateLogProcessmultivariate$ρ$ + marginalsthe models'
  • Scheme: exact means the law of the paths at the time steps is the one of the model, so a European payoff needs one step; Euler converges as the steps grow.
  • GPU: covered by the suite in test/cuda/ (run by hand, it needs a GPU; ShiftedProcess around Black-Scholes, the lognormal mixture, Kou and Variance Gamma); the other models may work in CudaMode but are not tested there. See Performance.
  • Enzyme: forward and reverse mode agree with ForwardDiff, see Automatic differentiation.
  • Closed form: a reference for the European prices of the Monte Carlo: FinancialToolbox.jl (blsprice), FinancialFFT.jl (from the characteristic function), FinancialCalibrator.jl (AnalyticMethod), or the formula given in the card.

Black-Scholes

\[dX_t = \left(μ_t - \frac{σ^2}{2}\right) dt + σ\,dW_t\]

BlackScholesProcess(σ)
BlackScholesProcess(0.2)
ParameterMeaningConstraint
σvolatility$σ > 0$

Simulated exactly (a GeometricBrownianMotion with the risk neutral drift). The reference for everything else: its European, binary and implied volatility formulas are in FinancialToolbox (blsprice, blsbin, blsimpv).

Bachelier

The normal model. Prices can be negative, so it is written for the price itself:

\[dS_t = μ_t S_t\,dt + σ\, e^{\int_0^t μ_s\,ds}\,dW_t, \qquad\text{that is}\qquad S_t = e^{\int_0^t μ_s\,ds} \left(S_0 + σ W_t\right).\]

The price discounted with the carry, $S_0 + σ W_t$, is an arithmetic Brownian motion and a martingale.

BachelierProcess(σ)
BachelierProcess(20.0)
ParameterMeaningConstraint
σnormal volatility, in units of the price$σ > 0$

$S_T$ is normal with mean the forward $F = S_0 e^{\int_0^T μ}$ and standard deviation $v = σ \sqrt{T} e^{\int_0^T μ}$, so a call is worth $e^{-\int_0^T r} \left[(F - K)\,Φ\!\left(\frac{F - K}{v}\right) + v\,φ\!\left(\frac{F - K}{v}\right)\right]$: the normal volatility at maturity $T$ is $σ e^{\int_0^T μ}$, $σ$ itself when $r = d$ (a future). Simulated exactly, as a BrownianMotion times the carry.

Heston

\[dX_t = \left(μ_t - \frac{v_t}{2}\right) dt + \sqrt{v_t}\,dW_t, \qquad dv_t = κ^*(θ^* - v_t)\,dt + σ \sqrt{v_t}\,dZ_t, \qquad d\langle W, Z\rangle_t = ρ\,dt\]

with $v_0 = σ_0^2$, $κ^* = κ + λ$ and $θ^* = κθ / (κ + λ)$.

HestonProcess(σ, σ₀, λ, κ, ρ, θ)
HestonProcess(0.5, 0.2, 0.0, 2.0, -0.7, 0.04)
ParameterMeaningConstraint
σvolatility of the variance$σ > 0$
σ₀initial volatility$σ_0 > 0$
λmarket price of volatility risk$κ + λ ≠ 0$
κspeed of mean reversion
ρcorrelation of the two Brownian motions$-1 ≤ ρ ≤ 1$
θlong term variance

Euler scheme on $X$ and on the variance, which is floored at a tiny positive value ($\sqrt{\text{floatmin}}$ of its number type) instead of zero. A smile with $ρ < 0$ slopes down. When the Feller condition $2κθ ≥ σ^2$ is badly violated the Euler scheme is biased: see #55, and use more time steps.

Merton

\[dX_t = \left(μ_t - \frac{σ^2}{2} - λ\left(e^{μ_J + σ_J^2/2} - 1\right)\right) dt + σ\,dW_t + dJ_t, \qquad J_t = \sum_{i=1}^{N_t} Y_i, \quad Y_i \sim \mathcal{N}(μ_J, σ_J^2)\]

with $N_t$ a Poisson process of intensity $λ$.

MertonProcess(σ, λ, μ_jump, σ_jump)
MertonProcess(0.2, 3.0, -0.05, 0.1)
ParameterMeaningConstraint
σvolatility of the diffusion$σ > 0$
λjump intensity (jumps per year)$λ > 0$
μ_jumpmean of the jumps of $X$
σ_jumpstandard deviation of the jumps of $X$$σ_J > 0$

A finite activity Lévy process: a Brownian motion plus a compound Poisson process (FiniteActivityProcess, fa_levy.jl). The jumps are simulated exactly, not discretised; with antithetic and Sobol sampling their count, times and sizes are drawn from uniforms by inversion, so that the paths of a pair mirror each other and the Sobol points cover the jumps too.

Kou

\[dX_t = \left(μ_t - \frac{σ^2}{2} - λ\left(\frac{p λ_+}{λ_+ - 1} + \frac{(1 - p) λ_-}{λ_- + 1} - 1\right)\right) dt + σ\,dW_t + dJ_t, \qquad Y_i = \begin{cases} +\text{Exp}(λ_+) & \text{with probability } p \\ -\text{Exp}(λ_-) & \text{with probability } 1 - p \end{cases}\]

with $J_t = \sum_{i=1}^{N_t} Y_i$ and $N_t$ a Poisson process of intensity $λ$.

KouProcess(σ, λ, p, λ₊, λ₋)
KouProcess(0.2, 5.0, 0.3, 30.0, 20.0)
ParameterMeaningConstraint
σvolatility of the diffusion$σ > 0$
λjump intensity$λ > 0$
pprobability of an up jump$0 ≤ p ≤ 1$
λ₊rate of the exponential up jumps$λ_+ > 1$ (finite forward)
λ₋rate of the exponential down jumps$λ_- > 0$

Simulated like Merton, by the same finite activity code: only the law of the jump sizes differs.

Variance Gamma

\[dX_t = (μ_t + ω)\,dt + θ\,dG_t + σ\,dW_{G_t}, \qquad G_{t + h} - G_t \sim \text{Gamma}\left(\frac{h}{κ}, κ\right), \qquad ω = \frac{1}{κ} \log\left(1 - \frac{σ^2 κ}{2} - θκ\right)\]

a Brownian motion with drift $θ$ and volatility $σ$ evaluated at a gamma subordinator $G$ of unit mean rate and variance rate $κ$.

VarianceGammaProcess(σ, θ, κ)
VarianceGammaProcess(0.2, -0.1, 0.2)
ParameterMeaningConstraint
σvolatility of the subordinated Brownian motion$σ > 0$
θdrift of the subordinated Brownian motion (skew)$1 - σ^2 κ / 2 - θ κ > 0$
κvariance rate of the subordinator (kurtosis)$κ > 0$

An infinite activity Lévy process (InfiniteActivityProcess, ia_levy.jl), exact at the time steps: a SubordinatedBrownianMotion whose subordinator increments are gamma draws (on the GPU, by a Marsaglia-Tsang kernel). Enzyme cannot differentiate it, because the gamma sampler of Distributions.jl draws scalar exponentials.

Normal Inverse Gaussian

\[dX_t = (μ_t + ω)\,dt + θ\,dI_t + σ\,dW_{I_t}, \qquad I_{t + h} - I_t \sim \text{InverseGaussian}\left(h, \frac{h^2}{κ}\right), \qquad ω = \frac{1}{κ}\left(\sqrt{1 - σ^2 κ - 2θκ} - 1\right)\]

the same construction as Variance Gamma with an inverse Gaussian subordinator $I$.

NormalInverseGaussianProcess(σ, θ, κ)
NormalInverseGaussianProcess(0.2, -0.1, 0.2)
ParameterMeaningConstraint
σvolatility of the subordinated Brownian motion$σ > 0$
θdrift of the subordinated Brownian motion$1 - σ^2 κ - 2θκ > 0$
κvariance rate of the subordinator$κ > 0$

On the GPU the subordinator is drawn by a Michael-Schucany-Haas kernel.

LogNormal mixture

The local volatility model of Brigo and Mercurio:

\[dX_t = \left(μ_t - \frac{σ^2(t, X_t)}{2}\right) dt + σ(t, X_t)\,dW_t, \qquad σ^2(t, x) = \frac{\sum_{i=1}^n λ_i η_i^2\, p_i(t, x)}{\sum_{i=1}^n λ_i\, p_i(t, x)}\]

where $p_i(t, \cdot)$ is the density of $X_t$ under Black-Scholes with volatility $η_i$. The law of $S_t$ is the mixture $\sum_i λ_i \text{Law}(S^i_t)$ at every time, so a European price is $\sum_i λ_i$ times the Black-Scholes price with volatility $η_i$ (the closed form of FinancialCalibrator's AnalyticMethod).

LogNormalMixture(η, λ)
LogNormalMixture((0.2, 0.3), (0.4,))   # weights 0.4 and 0.6
ParameterMeaningConstraint
ηtuple of the $n$ volatilitiesall positive
λtuple of the first $n - 1$ weights; the last is $1 - \sum λ$positive, $\sum λ ≤ 1$

Euler scheme on $X$, the local volatility at the start of each step; at $t = 0$ it is its limit $\sum_i λ_i η_i / \sum_i λ_i / η_i$. The weights are computed with the largest exponent factored out, so the far tails do not underflow. European prices converge to the closed form as the steps grow: with 50 steps the error is about a cent for volatilities such as 15% and 30%, but tens of cents when they are far apart (10% and 50%), where the local volatility jumps sharply with $X$. The parameters are tuples, so the number of components is in the type and a model can enter a GPU kernel.

Shifted models

Any single name model of this page, displaced by a deterministic amount that grows like the forward:

\[\frac{S_t}{S_0} = (1 - α)\, e^{Y_t} + α\, e^{\int_0^t μ_s\,ds}, \qquad\text{that is}\qquad X_t = \log\left((1 - α)\, e^{Y_t} + α\, e^{\int_0^t μ_s\,ds}\right)\]

where $Y$ is the log return of model (for a shifted Bachelier, $(1 - α) S_0$ plus the arithmetic part).

ShiftedProcess(model, α)
ShiftedProcess(BlackScholesProcess(0.2), 0.3)   # displaced diffusion
ShiftedProcess(HestonProcess(0.5, 0.2, 0.0, 2.0, -0.7, 0.04), 0.2)
ShiftedProcess(LogNormalMixture((0.2, 0.3), (0.4,)), 0.1)   # shifted lognormal mixture
ParameterMeaningConstraint
modelthe model of $Y$: its parameters, then α, are those of FinancialMonteCarlo.get_parameters
αshift, as a fraction of the spot$α < 1$

The forward is the one of model. With $0 ≤ α < 1$ the price stays above $α$ times the forward and the smile flattens (a displaced diffusion has a skew of its own: lower strikes, higher implied volatility); with $α < 0$ the price can go below zero. The spot and the dividends are those of the underlying passed with the shifted process, so delta bumps the shift too; model is simulated from Underlying((1 - α) S0, d). model is simulated by its own code, so every sampling, mode and automatic differentiation backend it supports works shifted.

A call of strike $K$ on $S_T$ is a call of strike $K - α F$ on the unshifted model started from $(1 - α) S_0$, $F$ the forward: any closed form of model prices the shifted one. For Black-Scholes it is blsprice((1 - α) * S0, K - α * F, r, T, σ, d) when $K > α F$. A shifted Bachelier is the Bachelier itself.

Gaussian copulas

GaussianCopulaNVariateProcess(ρ, model_1, model_2, model_3)
GaussianCopulaNVariateProcess(model_1, model_2, ρ₁₂)     # bivariate shortcut
GaussianCopulaNVariateLogProcess(ρ, model_1, model_2)    # copula on the log returns
ParameterMeaningConstraint
ρcorrelation matrix, one row per componentsymmetric positive definite
modelsany single name models above, also different ones

Each component $X^i$ follows its own model, so it keeps its marginal law; at every time step its values are then replaced by their empirical quantiles at the uniforms of a Gaussian copula with correlation $ρ$. They price baskets (EuropeanOptionND) and the positions of a Portfolios and multivariate set. Known limitations: the ranks are drawn again at each step, so a path does not stay continuous (#23), and the reordering sorts every column at every step (#46).

Any SDE

With StochasticDiffEq.jl loaded, FinancialMonteCarlo.MonteCarloDiffEqModel turns an EnsembleProblem (an SDE, or a jump diffusion) into a model priced like the others: see StochasticDiffEq.jl. It is the quickest way to try a model that is not here, at the cost of the speed, of the GPU and of the samplings of the native models. The engines the models above are built on, which new models can reuse, are in Models.

Not yet here

SABR, CEV, Bates and the other models that the current building blocks make easy to add are collected in #62. To write one yourself, see Extending the package.