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.