BDT Short Rate Model
A professional Python implementation of the Black-Derman-Toy (BDT) binomial short-rate model for interest rate derivatives pricing and calibration.
Installation
pip install bdt-short-rate
Quick Start
import numpy as np
from bdt import BDTModel, BDTCalibrator, SwaptionPricer
# Market spot rates (annualized)
spot_rates = np.array([0.03, 0.031, 0.032, 0.033, 0.034,
0.035, 0.0355, 0.036, 0.0365, 0.037])
# Create and calibrate the model
model = BDTModel(n_periods=10, b=0.05, dt=1.0)
calibrator = BDTCalibrator(model, spot_rates)
calibrator.calibrate()
# Price a swaption
pricer = SwaptionPricer(model)
price = pricer.price_payer_swaption(
expiry=5,
tenor=4,
strike=0.05,
notional=1_000_000
)
print(f"Swaption price: ${price:,.2f}")
Features
- Calibration: Fit model to market zero-coupon bond prices using scipy.optimize
- Pricing: Value swaptions, defaultable bonds, and other interest rate derivatives
- Lattice Visualization: Display the short-rate binomial tree
- CLI Interface: Command-line tools for production use
CLI Usage
# Calibrate model to market data
bdt calibrate --data market_rates.csv --volatility 0.05 --output calibrated.json
# Price a swaption
bdt price-swaption --model calibrated.json --expiry 5 --tenor 4 --strike 0.05
# Show the rate lattice
bdt show-lattice --model calibrated.json
Documentation
See the full documentation for detailed API reference and examples.
License
MIT License
Metadata
Release files for bdt-short-rate 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bdt_short_rate-1.0.0.tar.gz | 20.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bdt_short_rate-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.1 kB
Release files / bdt_short_rate-1.0.0.tar.gz
| Download URL | bdt_short_rate-1.0.0.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
092d3b7458221dcd99ebc178bc1c64918781f2405be4faaf87da1da5ce29b2a9
|
|
BLAKE2b-256 checksum How to use checksums |
ffc2b7fd74821e7d9aea69c3164a452e22b50e44c2b8b36ede47502386318dd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / bdt_short_rate-1.0.0-py3-none-any.whl
| Download URL | bdt_short_rate-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92e9052b5fd067b8b4b9f63b600e65959212178131dc3f2d22eb3256a6a4fc4a
|
|
BLAKE2b-256 checksum How to use checksums |
ec3522757715e326e383e4a48a590266182bd7ab10c20ad16c0c33f99c56f7d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|