Fast regimes in QuantLib's models
Which of QuantLib's models and processes take regime-switching parameters, and which method handles each.
Any model in QuantLib can have some of its parameters driven by a fast hidden chain. How far the expansion reaches depends on where the switched parameters enter the pricing equation.
The test
Many QuantLib models are exponential-affine: a price or characteristic function has the form
$$u_i(t, x) = e^{-B(t)\cdot x}\,a_i(t),$$where $B$ solves a Riccati equation. If the switched parameters do not appear in that Riccati equation, $B$ is the same in every regime. The regime then enters only through a forcing $g_i(t)$, and
$$a' = \big(Q + \operatorname{diag} g\big)\,a .$$The engine expands this to all orders, with the initial layer.
When the switched parameters do enter the Riccati equation, or the model is not affine, the first-order rule still applies to any Markov pricing equation. It adds the Green–Kubo term $\sum_{jk} K_{jk} A_j A_k$ to the averaged operator.
The catalogue
| QuantLib model or process | switch, all orders | switch, first order | checked here |
|---|---|---|---|
| BlackScholesProcess, GeometricBrownianMotionProcess | volatility, rate, dividend | Black–Scholes | |
| Merton76Process (JumpDiffusionEngine) | volatility, jump intensity, jump law | Merton | |
| VarianceGammaProcess | $\sigma$, $\nu$, $\theta$ | variance gamma | |
| HestonModel, PiecewiseTimeDependentHestonModel | variance level $\theta$ | $\kappa$, $\xi$, $\rho$ | Heston; $\theta$ and $\xi$ |
| BatesModel | variance level, jump intensity, jump law | $\kappa$, $\xi$, $\rho$ | Bates |
| Vasicek, HullWhite | mean level, volatility | reversion speed | regime switching; Hull–White; speed and volatility |
| CoxIngersollRoss, ExtendedCoxIngersollRoss | mean level | volatility, reversion speed | CIR |
| G2 (two-factor Gaussian) | both volatilities, correlation, level | reversion speeds | G2++ |
| GSR | volatility, level | reversion | |
| Other Gaussian1dModel subclasses, such as MarkovFunctional | all parameters | ||
| BSM–Hull–White | equity volatility, rate level, rate volatility, equity/rate correlation | rate reversion | equity with rates |
| HestonHullWhite, equity and rate uncorrelated (AnalyticHestonHullWhiteEngine) | variance level, rate level, rate volatility | $\kappa$, $\xi$, $\rho$, rate reversion | equity with rates |
| HestonHullWhite with equity/rate correlation; H1HW | all parameters | ||
| ExtendedOrnsteinUhlenbeckProcess, ExtOUWithJumpsProcess, KlugeExtOUProcess | level, volatility, jump intensity | reversion speed | jumps |
| BlackKarasinski | all parameters | ||
| CEV (AnalyticCEVEngine) | volatility scale, as a mixture over the total variance | elasticity $\beta$ | CEV |
| SABR (FdSABRVanillaEngine) | all parameters | ||
| Local volatility, HestonSLV, normal and square-root CLV models | all parameters | ||
| GemanRoncoroniProcess | all parameters | ||
| LIBOR market models | all parameters, in high dimension |
Three rows need a caveat.
- CEV is not exponential-affine, and it does not meet the test. Its switched volatility nevertheless scales a single operator once the price is written on the forward, so the regime enters only through one random total variance, and the price is a mixture of CEV prices to all orders. The CEV page has the argument.
- Gaussian1dModel is an interface: each subclass supplies its own numeraire and zero-bond functions. GSR is affine and meets the test. A subclass with a nonlinear numeraire, such as MarkovFunctional, does not, because a Gaussian state does not make the price exponential-affine. It falls under the first-order rule, with the boundary conditions of its own generator.
- Heston–Hull–White is affine only when the equity and the short rate are uncorrelated, which is the case AnalyticHestonHullWhiteEngine prices. With correlation $\rho_{xr}$ and rate volatility $\eta_i$ the generator contains the term below, which no exponential-affine form absorbs, whether or not anything switches:
AnalyticH1HWEngine replaces that term by an approximation, and the approximate model needs its own analysis. Black–Scholes–Hull–White has a constant equity volatility in place of $\sqrt v$, so the same term is a constant times $\partial_x\partial_r$, and it stays affine with any correlation.
Three families lie outside the framework. Rough Heston is not Markov.
GJR-GARCH is a discrete-time model, which would need the discrete-time analogue of the expansion. The credit loss models (Gaussian large-pool and other latent-factor models) are static one-period factor models; dynamic credit with switching hazards is on the credit page.
Products
- European options priced through characteristic functions use the engine directly, as on the Black–Scholes and Heston pages.
- Bond options and swaptions in affine short-rate models need the regime at expiry, which starts the initial layer at order zero, as on the bond options page.
- Asian and lookback options add a state variable. The pricing equation stays Markov, so the first-order rule applies to the enlarged generator.
- Barrier and American options add a boundary or a free boundary. The rule applies to the operator, and the boundary adds layers that are not treated here.
The instruments page gives the formulas for each, with coupon-bond options, swaptions, caps, credit default swaps and the geometric Asian option worked out.
The new checks
Merton's jump diffusion, variance gamma and Bates are Lévy or affine with constant or regime-free Riccati parts. For each, the regime-dependent forcing is the switched part of the characteristic exponent:
$$\begin{aligned} g_i &= \psi_i(u) &&\text{Merton, variance gamma}, \\ g_i(t) &= \kappa\,\theta_i\,D(t) + \lambda_i\,\big(\phi_J(u) - 1 - iu\bar k\big) &&\text{Bates}, \end{aligned}$$where $\psi_i$ is the Lévy exponent in regime $i$, $D$ the Heston Riccati solution, $\phi_J$ the jump characteristic function and $\bar k$ the mean jump size. The certificate compares the expansion with the numerical solution as the switching speeds up. Every order converges at its expected rate, from one to five, until the error reaches rounding. Each model now has its own page with the closed form to second order: Merton, variance gamma and Bates.
Certificate: verify_quantlib_models.py.