Skip to main content

Black-Derman-Toy binomial short-rate model for interest rate derivatives

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bdt_short_rate-1.0.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdt_short_rate-1.0.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file bdt_short_rate-1.0.0.tar.gz.

File metadata

  • Download URL: bdt_short_rate-1.0.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bdt_short_rate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 092d3b7458221dcd99ebc178bc1c64918781f2405be4faaf87da1da5ce29b2a9
MD5 3eb54b5262285f6faa6fbdcef39be829
BLAKE2b-256 ffc2b7fd74821e7d9aea69c3164a452e22b50e44c2b8b36ede47502386318dd0

See more details on using hashes here.

File details

Details for the file bdt_short_rate-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bdt_short_rate-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bdt_short_rate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92e9052b5fd067b8b4b9f63b600e65959212178131dc3f2d22eb3256a6a4fc4a
MD5 03f1438b740eab7bcbf08a16273e5d58
BLAKE2b-256 ec3522757715e326e383e4a48a590266182bd7ab10c20ad16c0c33f99c56f7d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page