← ClaudeAtlas

duration-convexity-and-dv01listed

Get the right duration number and the right DV01, for a bond, a floater or a hedge ratio. TRIGGER - Macaulay vs modified duration, effective duration, spread duration, key rate duration, DV01, PV01, BPV, dollar duration, basis point value, convexity, "my hedge ratio is off by a few percent", "duration says the price should be X but it is Y", duration times spread, floating rate note duration, FRN duration, "why is my floater duration almost zero", BondFunctions.duration, Duration.Macaulay vs Duration.Modified vs Duration.Simple, basisPointValue sign. SKIP for turning a price into a yield in the first place (yield-measures-and-bill-quotes), for accrued interest and day counts (bond-conventions-and-accrued), for the swap annuity and PV01 under OIS discounting (ois-discounting-and-multi-curve), and for portfolio VaR and risk aggregation (../../../fin-core/skills/portfolio-and-risk).
howard-lynn-ye/fin-skills · ★ 1 · AI & Automation · score 77
Install: claude install-skill howard-lynn-ye/fin-skills
# Duration, convexity and DV01 **"Duration" names at least four different numbers and "DV01" at least two.** Substituting one for another gives a risk report that is a few percent wrong — too small to notice, too large to hedge with. Every figure below is printed by `scripts/duration.py` (runs in **0.29 s**; QuantLib optional). ✅ Measured means this file produced it on 2026-09-09 with QuantLib 1.43, numpy 2.2.6, Python 3.11.3. > **The rule: Macaulay = (1 + y/m) × Modified, and only Modified belongs in a DV01. DV01 is on > the DIRTY price. Past 100 bp you need convexity. A floater's rate duration is the time to its > next reset, not its maturity.** ## 1. Macaulay and Modified differ by exactly (1 + y/m) ✅ Measured — the ratio is the compounding factor to the last digit: | bond | Macaulay | Modified | ratio | 1 + y/m | DV01 overstated by | |---|---|---|---|---|---| | 5% 10y semiannual @ 5% | 7.98944567 | 7.79458114 | 1.02500000 | 1.02500000 | **+2.50%** | | 5% 10y quarterly @ 5% | 7.92962996 | 7.83173329 | 1.01250000 | 1.01250000 | +1.25% | | 4% 30y semiannual @ 4% | 17.72805221 | 17.38044334 | 1.02000000 | 1.02000000 | +2.00% | | **12% 10y semiannual @ 12%** | 6.07905825 | 5.73496061 | 1.06000000 | 1.06000000 | 🚨 **+6.00%** | | 0% 10y semiannual @ 5% | 10.00000000 | 9.75609756 | 1.02500000 | 1.02500000 | +2.50% | 🚨 **The error is one-directional and grows with the level of rates.** A hedge sized off a Macaulay duration is always too big, by exactly `y/m`. On a zero-co