interest-rate-models

Classic interest rate models in Python: short-rate models (Vasicek, CIR, Ho-Lee, Hull-White, G2++) and full-curve models (Heath-Jarrow-Morton, LIBOR Market Model) behind one interface.

Every model provides analytic zero-coupon bond and European option pricing where the model admits closed forms, Monte Carlo simulation (exact transition sampling wherever the transition law is known), and curve calibration appropriate to its family. Caps and floors are priced by static replication for the short-rate models and by Black’s formula for the LMM.

Features

  • Five short-rate models: Vasicek and CIR (equilibrium), Ho-Lee, Hull-White, and G2++ (no-arbitrage, fitted exactly to the input curve)

  • Two full-curve models: multi-factor Gaussian HJM with the no-arbitrage drift computed automatically, and a lognormal-forward LMM with correlated forwards, Black caplets, and Rebonato swaptions

  • A market curve object: shape-preserving discount curve interpolation with smooth instantaneous forwards, built from discount factors or zero rates

  • Validated numerics: every closed-form formula is tested against Monte Carlo, and the model-equivalence limits (HJM to Ho-Lee/Hull-White, G2++ to Hull-White) are enforced in the test suite

Installation

pip install interest-rate-models

Requires Python >= 3.13.

Examples

The repository’s examples directory contains one executed Jupyter notebook per model, all built on the same live Treasury curve (via yfinance) with a shared structure — curve fit, simulated paths, terminal distribution, pricing — so the models’ figures are directly comparable.