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.
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).
| Model | Family | Parameters | Scheme | GPU | Enzyme | Closed form |
|---|---|---|---|---|---|---|
BlackScholesProcess | diffusion | 1 | exact | tested | yes | FinancialToolbox, FinancialFFT |
BachelierProcess | normal diffusion | 1 | exact | tested | yes | Bachelier formula |
HestonProcess | stochastic volatility | 6 | Euler | yes | FinancialFFT | |
MertonProcess | jump diffusion | 4 | exact | tested | yes | FinancialFFT |
KouProcess | jump diffusion | 5 | exact | tested | yes | FinancialFFT |
VarianceGammaProcess | infinite activity Lévy | 3 | exact | tested | no | FinancialFFT |
NormalInverseGaussianProcess | infinite activity Lévy | 3 | exact | tested | yes | FinancialFFT |
LogNormalMixture | local volatility | $2n - 1$ | Euler | tested | yes | FinancialCalibrator |
ShiftedProcess | any of the above, shifted | model + 1 | the model's | tested | yes | strike shift |
GaussianCopulaNVariateProcess | multivariate | $ρ$ + marginals | the models' | |||
GaussianCopulaNVariateLogProcess | multivariate | $ρ$ + marginals | the 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;ShiftedProcessaround Black-Scholes, the lognormal mixture, Kou and Variance Gamma); the other models may work inCudaModebut 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | volatility of the diffusion | $σ > 0$ |
λ | jump intensity (jumps per year) | $λ > 0$ |
μ_jump | mean of the jumps of $X$ | |
σ_jump | standard 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | volatility of the diffusion | $σ > 0$ |
λ | jump intensity | $λ > 0$ |
p | probability 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | 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)| Parameter | Meaning | Constraint |
|---|---|---|
σ | 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| Parameter | Meaning | Constraint |
|---|---|---|
η | tuple of the $n$ volatilities | all 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| Parameter | Meaning | Constraint |
|---|---|---|
model | the 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| Parameter | Meaning | Constraint |
|---|---|---|
ρ | correlation matrix, one row per component | symmetric positive definite |
models | any 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.