# BondStats Open Research Templates

**Free, reusable and reproducible fixed-income research templates.**

Four Python 3 standard-library templates plus illustrative CSV input data:

1. `bond_pricing_duration.py` — periodic fixed-coupon bond price, Macaulay/modified duration, convexity and DV01. Settlement on coupon date only; excludes accrued interest, taxes, credit, embedded options.
2. `yield_curve_scenarios.py` — piecewise-linear yield interpolation, parallel shocks, and illustrative pivot steepener; no extrapolation.
3. `sovereign_auction_tail.py` — stop-yield vs when-issued yield in basis points; positive = tail, negative = through. Illustrative data, not actual auctions.
4. `portfolio_rate_risk.py` — duration/convexity parallel-shift approximation for a long-only portfolio; no spread or nonparallel risk.

## Run

Install Python 3.9+ (no third-party packages required). Place all files in one folder and run:

```sh
python bond_pricing_duration.py
python yield_curve_scenarios.py
python sovereign_auction_tail.py
python portfolio_rate_risk.py
```

Edit CSV input files to use your own data. The CSVs shipped here are **synthetic and illustrative**, not current market observations. Always check units: yields in percentage points for CSV inputs; decimal annualized rates for the bond-pricing function; shifts in basis points.

## License

Code: MIT License (see LICENSE). Sample CSV data: CC0-1.0. Attribution is appreciated, but not a condition of reuse. No warranties or investment advice. Do not imply endorsement by BondStats.

Source: https://www.bondstats.org/tools/developer-tools/research-templates/
