Measure interest-rate sensitivity
bond_analytics_toolCalculate bond risk metrics including Macaulay duration, modified duration, DV01, and convexity from price or yield. Validates results numerically for accurate fixed-income analysis.
Instructions
Macaulay duration, modified duration, DV01 and convexity.
Supply either a price or a yield, not both.
modified_duration_years divides Macaulay duration by one plus the
PERIODIC yield. naive_modified_duration_years shows what dividing by one
plus the ANNUAL yield would give — the standard error on any bond paying
more than once a year. effective_duration_years is computed numerically
by central differences and uses no annualisation, so it arbitrates between
them. Report the modified figure; the other two are there to prove it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ytm_pct | No | Nominal annual yield as a percentage, e.g. 4.6867. Supply either this or clean_price_pct_of_face, never both. | |
| day_count | No | Day-count convention used for accrual. ACT/ACT ICMA is the standard for most government and corporate bonds. | ACT/ACT ICMA |
| face_value | Yes | Redemption amount in currency units, e.g. 1000. | |
| issue_date | Yes | Issue (dated) date in ISO format, e.g. 2024-03-15. | |
| maturity_date | Yes | Redemption date in ISO format, e.g. 2029-03-15. | |
| coupon_rate_pct | Yes | Annual coupon rate as a PERCENTAGE. Pass 4.0 for a 4% coupon, not 0.04. Zero for a zero-coupon bond. | |
| settlement_date | Yes | Valuation date in ISO format. Must fall between issue and maturity, e.g. 2025-09-11. | |
| payments_per_year | Yes | Coupon payments per year: 1 annual, 2 semi-annual, 4 quarterly, 12 monthly. Most government bonds pay semi-annually. | |
| clean_price_pct_of_face | No | Quoted clean price as a percentage of face, e.g. 97.80. Supply either this or ytm_pct, never both. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||