Skip to main content

Module models

Module models 

Expand description

Pricing models: closed-form and short-rate engines.

Every engine here is written once, against R: Scalar. A model is a formula, and a formula does not know which mode it will be evaluated in — that is the whole claim the seam makes, and a model layer is where it is easiest to break by hand-coding derivatives.

Notably absent: hand-written greeks. A Black delta is ∂C/∂F, and the mode computes it. Writing one out would be restating the formula’s own derivative in a second place, where it can disagree with the first.

Models sit below instruments, which is where their traffic says they belong: an instrument reaches for a model far more often than a model reaches for an instrument, and the few places that do are in the Hull-White calibration that belongs to the calibration layer.

Modules§

analytic
Closed-form option formulas.
credit
Portfolio credit loss models: the one-factor Gaussian and double-t copulas (Copula) and the large-homogeneous-pool (LHP) expected tranche loss. The formulas below are the Gaussian’s; the double-t replaces Φ by the unit-variance t CDFs of the factor and the names, and Φ⁻¹ by the inverse of the latent variable’s CDF, a convolution computed by quadrature.
fx_option
Garman-Kohlhagen conventions: the delta-neutral ATM strike and strike-from-delta under the four market delta conventions.
hw_calibration
Calibrating Hull-White’s volatility to a co-terminal swaption strip — flat, by least squares, or as a piecewise-constant term, bootstrapped exactly.
lattice
The Hull-White trinomial lattice, written once against Scalar.
repack_gap
The repack gap charge, in closed form.
repack_sim
The repack gap by Monte Carlo: crises, the valuation trigger and its lag.
sabr
SABR implied volatilities and the at-the-money α solve that lets a surface be parameterised by the ATM vol a desk quotes.
short_rate
The one-factor Hull-White short-rate engine.
student_t 🔒
The Student-t distribution scaled to unit variance, for the double-t copula: Z = s·T_ν, s = √((ν − 2)/ν), ν > 2.