{"id":44706716,"url":"https://github.com/narasiva90/cmtratebootstrap","last_synced_at":"2026-03-01T09:02:18.364Z","repository":{"id":338585520,"uuid":"1158372796","full_name":"NaraSiva90/CMTRateBootstrap","owner":"NaraSiva90","description":"Bootstrap arbitrage-free yield curves from US Treasury CMT rates using piecewise linear or monotone cubic forward interpolation","archived":false,"fork":false,"pushed_at":"2026-02-15T09:13:35.000Z","size":299,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-15T15:08:44.963Z","etag":null,"topics":["bootstrap","finance","fixed-income","monotone-splines","quantitative-finance","treasury","yield-curve"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NaraSiva90.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-15T08:57:26.000Z","updated_at":"2026-02-15T09:09:19.000Z","dependencies_parsed_at":"2026-02-15T15:09:49.592Z","dependency_job_id":null,"html_url":"https://github.com/NaraSiva90/CMTRateBootstrap","commit_stats":null,"previous_names":["narasiva90/cmtratebootstrap"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/NaraSiva90/CMTRateBootstrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaraSiva90%2FCMTRateBootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaraSiva90%2FCMTRateBootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaraSiva90%2FCMTRateBootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaraSiva90%2FCMTRateBootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NaraSiva90","download_url":"https://codeload.github.com/NaraSiva90/CMTRateBootstrap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaraSiva90%2FCMTRateBootstrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29965419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T06:55:38.174Z","status":"ssl_error","status_checked_at":"2026-03-01T06:53:04.810Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","finance","fixed-income","monotone-splines","quantitative-finance","treasury","yield-curve"],"created_at":"2026-02-15T11:02:55.008Z","updated_at":"2026-03-01T09:02:18.355Z","avatar_url":"https://github.com/NaraSiva90.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Treasury CMT Yield Curve Bootstrap\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nBootstrap discount factors and zero-coupon yield curves from US Treasury CMT rates.\n\n## Quick Start\n\n### 1. Install Dependencies\n```bash\npip install -r requirements.txt\n```\n\n### 2. Download Historical Data\nDownload the Treasury par yield curve data (1990-2023) from:\nhttps://home.treasury.gov/resource-center/data-chart-center/interest-rates/TextView?type=daily_treasury_yield_curve\n\nSave as: `data/par-yield-curve-rates-1990-2023.csv`\n\n### 3. Build Initial Dataset\n```bash\n# All data from 1990\npython scripts/build_initial_treasury_file.py\n\n# Or filter to recent years (recommended for faster processing)\npython scripts/build_initial_treasury_file.py --start-date 2022-01-01\n```\n\nThis creates `Treasury_CMT_Data_Tool.xlsx` with combined historical + current data.\n\n### 4. Run Bootstrap\n```bash\n# Scheme 2 (piecewise linear forward - recommended)\npython scripts/run_bootstrap.py --scheme 2\n\n# Scheme 3 (monotone cubic forward - smoother) with Excel output\npython scripts/run_bootstrap.py --scheme 3 --write-excel\n```\n\nOutputs:\n- `Treasury_CMT_Data_Tool_curves_S2_YYYY-YYYY.npz` (compressed data)\n- `Treasury_CMT_Data_Tool_curves_S2_YYYY-YYYY.xlsx` (human-readable)\n\n### 5. Update Data (Ongoing)\n```bash\npython scripts/update_treasury_cmt.py\n```\n\nUpdates `Treasury_CMT_Data_Tool.xlsx` with latest rates from Treasury API.\n\n## 📊 Interactive Visualization\n\nExplore bootstrapped yield curves with mathematically correct reconstruction:\n```bash\n# Run with sample data (2022-2026 included)\npython -m streamlit run scripts/yield_curve_app.py\n```\n\n### Why Curve Reconstruction Matters\n\nMost yield curve tools use **linear interpolation** between tenor points - this is mathematically incorrect!\n\nOur approach **reconstructs continuous curves** from bootstrap parameters:\n- **S1:** Piecewise constant forwards → Exponential discount decay  \n- **S2:** Piecewise linear forwards → Smooth exponential decay  \n- **S3:** Monotone cubic forwards → Perfectly smooth curves\n\n### Features\n\n**Tab 1: Yield Curves**\n- Par, spot, and forward rates (smooth reconstruction)\n- Discount factor curves (exponential decay)\n- Spot-par spread analysis\n- Data table with CSV export (expandable)\n\n![S3 Smooth Curves](docs/images/yield_curves_s3.png)\n*Scheme 3 shows perfectly smooth forward rates - true cubic interpolation, not linear approximation*\n\n**Tab 2: Spread Analysis**\n- Compare any two tenors (e.g., 10Y-2Y inversion)\n- Date range filtering\n- Distribution histograms with statistics\n\n**Tab 3: Forward Projections**\n- Forward term structure: f(0, s, s+M)\n- Multiple tenors (1Mo to 30Yr)\n- Shows market rate expectations\n- Progressive smoothing demonstration\n\n![Forward Term Structure](docs/images/forward_projections.png)\n*Progressive smoothing: 1Mo forward is jagged, 10Yr forward is smooth - mathematics visualized*\n\nSee [Visualization Guide](docs/VISUALIZATION_GUIDE.md) for complete documentation.\n\n\n## Project Structure\n\n```\ncmt-yield-curve-bootstrap/\n├── README.md                          # This file\n├── LICENSE\n├── requirements.txt                   # Python dependencies\n├── .gitignore\n│\n├── src/\n│   └── cmt_bootstrap.py              # Core bootstrap algorithms\n│\n├── scripts/\n│   ├── run_bootstrap.py              # Wrapper to run bootstrap on Excel file\n│   ├── update_short_rates.py         # Combine SOFR/Fed Funds histories\n│   ├── update_treasury_cmt.py        # Fetch latest CMT rates from Treasury API\n│   └── build_initial_treasury_file.py # One-time: build complete historical dataset\n│\n├── data/\n│   ├── Treasury_CMT_Data_Tool.xlsx   # Main data file (generated by build script)\n│   ├── par-yield-curve-rates-1990-2023.csv  # Historical data (download from Treasury)\n│   └── short_rates/\n│       ├── fed_funds_1954_2018.csv   # FRED DFF series (included)\n│       └── sofr_manual.csv           # SOFR baseline (included)\n│       # short_rate_combined.csv     # Generated by update_short_rates.py\n│\n└── docs/\n    ├── USER_GUIDE.md                 # Detailed usage guide\n    └── BOOTSTRAP_GUIDE.md            # Bootstrap methodology\n```\n\nV1.1 Directory Structure:\n```\ncmt-yield-curve-bootstrap/\n├── README.md                        ← UPDATE\n├── LICENSE\n├── requirements.txt                 ← UPDATED\n├── .gitignore                      ← UPDATE\n├── RELEASE_NOTES.md                ← NEW\n│\n├── src/\n│   └── cmt_bootstrap.py\n│\n├── scripts/\n│   ├── yield_curve_app.py          ← NEW\n│   ├── curve_reconstruction.py     ← NEW\n│   ├── build_initial_treasury_file.py\n│   ├── update_treasury_cmt.py\n│   ├── update_short_rates.py\n│   └── run_bootstrap.py\n│\n├── data/\n│   ├── samples/                    ← NEW\n│   │   ├── README.md               ← NEW\n│   │   ├── Treasury_CMT_curves_S1_2022_2026.npz  ← NEW\n│   │   ├── Treasury_CMT_curves_S2_2022_2026.npz  ← NEW\n│   │   └── Treasury_CMT_curves_S3_2022_2026.npz  ← NEW\n│   └── short_rates/\n│       ├── fed_funds_1954_2018.csv\n│       └── sofr_manual.csv\n│\n└── docs/\n    ├── USER_GUIDE.md\n    ├── BOOTSTRAP_GUIDE.md\n    ├── VISUALIZATION_GUIDE.md      ← NEW\n    ├── CURVE_RECONSTRUCTION.md     ← NEW\n    ├── INSTALLATION_GUIDE.md       ← NEW\n    └── images/                     ← NEW\n        ├── yield_curves_s1.png\n        ├── yield_curves_s3.png\n        ├── spread_analysis.png\n        └── forward_projections.png\n```\n\n## Bootstrap Schemes\n\n**Scheme 1:** Piecewise constant instantaneous forward\n- Simplest, fast\n- Discontinuous forwards\n\n**Scheme 2:** Piecewise linear instantaneous forward\n- Good balance of speed and smoothness\n- **Recommended for most use cases**\n\n**Scheme 3:** Monotone cubic instantaneous forward\n- Smoothest curves\n- Slower computation\n- Best for derivatives pricing\n\n## Output Files\n\n### NPZ File (Primary)\nCompressed NumPy archive with:\n- Par rates (input)\n- Discount factors at each tenor\n- Spot (zero) rates (continuous compounding)\n- Forward rates at tenor endpoints\n- Bootstrap parameters (scheme-dependent)\n- Validation: implied par rates, round-trip errors\n\n### Excel File (Optional)\n\n```bash\n# Output to excel modifier\npython scripts/run_bootstrap.py --scheme 2 --write-excel\n```\n\nHuman-readable tables:\n- Par Rates (input)\n- Discount Factors\n- Spot Rates (cc)\n- Forward @ TenorEnd\n- Par Rates (implied)\n- Round-Trip Error (bp)\n- Bootstrap parameters\n\n## Data Sources\n\n**CMT Rates:** US Treasury Department\n- Historical: CSV download (1990-2023)\n- Recent: XML API (2024-present)\n\n**Short Rates (r₀ anchor):**\n- SOFR: 2018-present (preferred)\n- Effective Fed Funds: 1954-2018 (fallback)\n\n## Notes\n\n- Par rates interpreted as swap/coupon-equivalent rates\n- Missing tenors are skipped (no interpolation)\n- Payment frequency: 24 per year (semi-monthly, configurable with `--nu`)\n- All rates stored in decimal form (0.0555 = 5.55%)\n\n## References\n\n- US Treasury: https://home.treasury.gov/\n- FRED (Fed Funds): https://fred.stlouisfed.org/series/DFF\n- NY Fed (SOFR): https://www.newyorkfed.org/markets/reference-rates/sofr\n\n## License\n\nMIT License\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarasiva90%2Fcmtratebootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarasiva90%2Fcmtratebootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarasiva90%2Fcmtratebootstrap/lists"}