Metadata-Version: 2.4
Name: interest-rate-models
Version: 0.1.0
Summary: Classic interest rate models in Python: Vasicek, CIR, Ho-Lee, Hull-White, G2++, HJM, and the LIBOR Market Model.
Project-URL: Documentation, https://interest-rate-models.readthedocs.io
Project-URL: Repository, https://github.com/marwinsteiner/interest-rate-models
Project-URL: Issues, https://github.com/marwinsteiner/interest-rate-models/issues
Author: Marwin Steiner
License: MIT
License-File: LICENSE
Requires-Python: >=3.13
Requires-Dist: numpy>=2.0
Requires-Dist: scipy>=1.14
Description-Content-Type: text/markdown

# interest-rate-models

[![CI/CD](https://github.com/marwinsteiner/interest-rate-models/actions/workflows/python-publish.yml/badge.svg)](https://github.com/marwinsteiner/interest-rate-models/actions/workflows/python-publish.yml)
[![PyPI](https://img.shields.io/pypi/v/interest-rate-models)](https://pypi.org/project/interest-rate-models/)
[![Python](https://img.shields.io/pypi/pyversions/interest-rate-models)](https://pypi.org/project/interest-rate-models/)
[![codecov](https://codecov.io/gh/marwinsteiner/interest-rate-models/branch/main/graph/badge.svg)](https://codecov.io/gh/marwinsteiner/interest-rate-models)
[![Docs](https://readthedocs.org/projects/interest-rate-models/badge/?version=latest)](https://interest-rate-models.readthedocs.io)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

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, with analytic bond and option pricing where it exists and exact or discretized Monte Carlo simulation everywhere.

**Full documentation: [interest-rate-models.readthedocs.io](https://interest-rate-models.readthedocs.io)**

## Installation

```bash
pip install interest-rate-models
```

Requires Python >= 3.13.

## Quick start

```python
import numpy as np
from interest_rate_models import DiscountCurve, get_model

# Market curve: pillar maturities and continuously-compounded zero rates
curve = DiscountCurve.from_zero_rates(
    times=np.array([0.5, 1.0, 2.0, 5.0, 10.0]),
    zero_rates=np.array([0.030, 0.032, 0.034, 0.037, 0.039]),
)

# No-arbitrage short-rate model fitted to the curve
hw = get_model("hull-white", curve=curve, a=0.1, sigma=0.01)
print(hw.bond_price(0.0, 5.0))          # reproduces curve.discount(5.0)
print(hw.bond_option(1.0, 5.0, strike=0.85, kind="call"))

# Equilibrium model calibrated to the curve
vasicek = get_model("vasicek", kappa=0.5, theta=0.04, sigma=0.01)
params = vasicek.calibrate(curve, r0=0.03)

# Full-curve models
lmm = get_model("lmm", curve=curve, tenor=0.5, n_periods=10, vol=0.20)
print(lmm.cap_price(strike=0.035))
```

The factory accepts `"vasicek"`, `"cir"`, `"ho-lee"`, `"hull-white"`, `"g2++"`, `"hjm"`, and `"lmm"`. See the [documentation](https://interest-rate-models.readthedocs.io) for each model's dynamics, formulas, parameters, and configuration.

## Contributing

Contributions, bug reports, and feature requests are welcome. Open an issue or submit a PR on [GitHub](https://github.com/marwinsteiner/interest-rate-models).

## License

MIT
