Price a swap with separate projection and discount curves, and catch the single-curve bug that the standard par-reprice check cannot see. TRIGGER - OIS discounting, CSA discounting, collateral discounting, multi-curve, dual curve, projection curve vs discount curve, tenor basis, "my swap reprices at par but the PV01 is wrong", swap annuity, fixedLegBPS, DiscountingSwapEngine, RelinkableYieldTermStructureHandle, linkTo, "QuantLib NPV is exactly 0.0", exogenous discounting rate helpers, bootstrapping a SOFR curve against an OIS discount curve, swaption numeraire, forward premium. SKIP for computing the compounded SOFR fixing itself (sofr-and-rfr-compounding), for what a legacy LIBOR trade falls back to (libor-transition-and-fallbacks), for bond duration and DV01 (duration-convexity-and-dv01), and for curve bootstrapping and interpolation in general (../../../fin-models/skills/term-structure-models).
Ships in fin-fixed-income. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A collateralised swap needs two curves: one to project the coupons and one to discount them. Build one curve, use it for both, and the check everyone runs — "does the swap reprice at par?" — still passes. The par rate is the one quantity in the whole calculation that is almost blind to the discount curve.
Every figure below is printed by scripts/multi_curve.py (runs in 0.3 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 worked trade is a 10-year swap, 100,000,000 notional, semiannual fixed
against quarterly floating, K = 4.50%, on an OIS zero curve rising 2.90% → 3.60% with a
projection curve of OIS + 26.161 bp.
The rule: the par swap rate is a discount-WEIGHTED AVERAGE of the projected forwards and barely moves when you change the discount curve. The annuity is a LEVEL and moves by the whole basis. Check the annuity, not the par rate.
✅ Measured:
| par rate | swap struck at its own par rate prices at | |
|---|---|---|
| OIS discounting | 3.75361656% | +0.00e+00 |
| projection discounting (the bug) | 3.75316548% | +0.00e+00 |
🚨 Both reprice at par to machine precision. The test has no power to distinguish them, because a swap struck at its own par rate is zero by construction under whatever discount curve computed that par rate. It is a self-consistency check, not a validation.
✅ Measured on the same swap:
| OIS discounting | projection discounting | difference | |
|---|---|---|---|
| par swap rate | 3.75361656% | 3.75316548% | −0.045 bp |
| annuity (years) | 8.42485066 | 8.31654893 | 🚨 −1.286 % |
| PV01 | 84,248.51 | 83,165.49 | 🚨 −1,083.02 |
| NPV at K = 4.50% | −6,288,169.05 | −6,211,085.81 | 🚨 +77,083.24 |
🚨 The par rate moved 0.045 bp. The annuity moved 1.286%. That 1.286% is a multiplicative factor on:
None of it shows up in a par rate, a fair rate, or a repricing test.
S = sum(tau_i f_i D_i) / sum(tau_j D_j)
S is a ratio of two sums over the same discount factors. Change D and you change only the
weights of an average. A = sum(tau_j D_j) is not an average of anything — it is a level.
✅ Measured on a flat forward curve with fixed and floating on the same quarterly schedule, where the cancellation is exact:
| OIS discounting | projection discounting | difference | |
|---|---|---|---|
| par rate | 3.5775134989% | 3.5775134989% | −0.00000000 bp |
| annuity | 8.48237640 | 8.37565384 | −1.2582 % |
✅ The same curve with a semiannual fixed leg against a quarterly float leg leaves a residual of +0.118 bp — the sums are over different dates, so the cancellation is no longer perfect. 0.118 bp against an annuity that moved 1.2582%: the par-rate check is not imprecise, it is looking at the wrong quantity.
| basis (bp) | par rate S | Δ par rate | Δ annuity | PV01 error | NPV error |
|---|---|---|---|---|---|
| 5.000 | 3.5392% | −0.010 bp | −0.247 % | −208 | +19,195 |
| 10.000 | 3.5898% | −0.019 bp | −0.494 % | −416 | +36,271 |
| 26.161 | 3.7536% | −0.045 bp | −1.286 % | −1,083 | +77,083 |
| 50.000 | 3.9954% | −0.072 bp | −2.438 % | −2,054 | +97,750 |
| 100.000 | 4.5028% | −0.082 bp | 🚨 −4.796 % | −4,041 | −7,743 |
(S − K) × ΔA, so it vanishes at the money — at a 100 bp basis
S = 4.5028% ≈ K = 4.50% and the NPV error collapses to −7,743 while the annuity error is at its
worst. A portfolio checked only on at-the-money trades will look clean. The PV01 error does
not vanish anywhere.✅ ql.VanillaSwap + ql.DiscountingSwapEngine, same curves:
| OIS discounting | projection discounting | difference | |
|---|---|---|---|
fairRate() | 3.75561726% | 3.75507846% | −0.054 bp |
annuity from fixedLegBPS | 8.42686799 | 8.31816553 | −1.290 % |
NPV() | −6,272,815.07 | −6,196,380.69 | +76,434.38 |
⚠️ QuantLib's absolute numbers differ from the reference implementation in the third decimal of
a percent because it uses real business-day schedules and 30/360 vs ACT/360 accruals where the
reference uses exact 1/freq periods. The shape is what matters and it matches: 0.054 bp on
the par rate, 1.290% on the annuity.
RelinkableYieldTermStructureHandle is a live reference✅ Measured: relinking the discount handle to an OIS curve +10 bp moves an already constructed swap's NPV from −6,272,815.07 to −6,243,442.24 (+29,372.83) with no recalculation call and no notification you can see. That is the design — handles are observables — and it means:
discountingCurve=ois_handle re-bootstrap when that handle is
relinked, so changing the discount curve silently changes the projection curve too. Build,
freeze, and re-read the projection curve rather than assuming it is inert.evaluationDate gives NPV exactly 0.0✅ Measured: pushing Settings.instance().evaluationDate one day past maturity makes the same
swap return NPV = 0.0 — not an error, not a warning, not nan. Every cash flow has occurred,
so the sum is empty. See ../../../fin-libraries/skills/lib-quantlib/SKILL.md; it is the single
most common way a QuantLib pricing script produces a plausible zero.
sum(tau_j D_j) under your discount curve against the
OIS curve directly. It is one line and it is the quantity that moves.DiscountingSwapEngine, and it is a different
argument from the one inside the IborIndex.fixedLegBPS, not NPV, when you change discounting.scripts/multi_curve.py — numpy only at import; QuantLib inside one function.
| Function | Does |
|---|---|
Curve(times, zeros, spread) | log-linear-on-discount zero curve; .discount, .forward, .zero, .shifted |
flat_curve(rate) | §3's flat forward curve |
annuity(discount, tenor, fixed_freq) | sum(tau_j D_j) — the level |
floating_leg_pv(projection, discount, ...) | forwards off one curve, discounting off the other |
par_swap_rate(projection, discount, ...) | §1, §3 — the weighted average |
swap_npv(K, N, projection, discount, ...) / pv01(N, discount, ...) | §2 |
discounting_comparison(ois, projection, ...) | the §2 table |
reprices_at_par(...) | §1 — the check with no power |
basis_sensitivity(ois, bases_bp, ...) | §4 |
quantlib_cross_checks(...) | §5, including the relink and the stale-date effects, or None |
../sofr-and-rfr-compounding/SKILL.md — the fixings and averages the projection curve is
built from, and 🚨 the four few-bp errors in compounding one.../libor-transition-and-fallbacks/SKILL.md — 🚨 the basis used here (26.161 bp) is the
statutory three-month tenor spread adjustment in 12 CFR 253.4(c); that skill is where the
legacy trades get their new floating leg.../duration-convexity-and-dv01/SKILL.md — the bond side of the same arithmetic: 🚨 Macaulay
vs modified is exactly (1 + y/m), and QuantLib's Duration.Modified is silently 28.6% low on
a non-compounded InterestRate.../../../fin-models/skills/term-structure-models/SKILL.md — bootstrapping, interpolation and
🚨 the six different "5-year zero rates" one discount factor can be. Curve construction
lives there; this skill is about which curve goes where.../../../fin-libraries/skills/lib-quantlib/SKILL.md — 🚨 evaluationDate as a global,
handle lifetimes, and ql.Date being day-first.../../../fin-core/skills/derivatives-pricing/SKILL.md — 🚨 rateslib is not open source;
QuantLib term structures are the permissive route for everything above.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
7 skills in this plugin
/bond-conventions-and-accruedCompute accrued interest, clean and dirty prices and day-count year fractions on a bond without silently picking the wrong convention. TRIGGER - accrued interest, day count, daycount, ACT/ACT ICMA vs ISMA vs ISDA, ACT/365F, ACT/360, 30/360, 30E/360, 30E/360 ISDA, Thirty360 BondBasis vs USA vs European vs NASD, year fraction, yearFraction, ActualActual(ISMA), "my accrued interest is off by a few hundred dollars", "which 30/360 is this", clean price vs dirty price vs invoice price, settlement amount, T+1 settlement, quasi-coupon date, first and last stub period. SKIP for negative accrued inside a gilt ex-dividend window (ex-dividend-and-rebate-interest), for turning a price into a yield (yield-measures-and-bill-quotes), for duration and DV01 (duration-convexity-and-dv01), for discount-curve conventions and compounding (../../../fin-models/skills/term-structure-models), and for QuantLib's evaluationDate global (../../../fin-libraries/skills/lib-quantlib)./duration-convexity-and-dv01Get 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)./ex-dividend-and-rebate-interestHandle bonds that trade ex-dividend, where accrued interest goes negative and the buyer is paid rebate interest instead of paying it. TRIGGER - gilt, UK gilt, ex-dividend, ex-div, ex-coupon, exCouponPeriod, rebate interest, negative accrued interest, "my accrued interest is negative", "accrued should be negative but isn't", seven business days before the coupon, quasi-coupon date, DMO formulae, "Formulae for Calculating Gilt Prices from Yields", ql.FixedRateBond exCouponPeriod, ql.Period(-7, ql.Days), record date vs ex-date on a bond, 3.5% War Loan, JGB and gilt settlement. SKIP for ordinary positive accrued and day-count choice (bond-conventions-and-accrued), for price-to-yield solving in general (yield-measures-and-bill-quotes), for index-linked gilt indexation lags (../../../fin-models/skills/term-structure-models), and for QuantLib's evaluationDate global (../../../fin-libraries/skills/lib-quantlib)./libor-transition-and-fallbacksWork out what a US dollar LIBOR contract actually falls back to under the LIBOR Act, and why the spread everyone quotes is the easy half. TRIGGER - LIBOR fallback, LIBOR transition, Regulation ZZ, 12 CFR 253, LIBOR Act, Board-selected benchmark replacement, tenor spread adjustment, 26.161 bp, 0.26161, 11.448 bp, 71.513 bp, ISDA 2020 IBOR Fallbacks Protocol, Fallback Rate (SOFR), CME Term SOFR, 30-day Average SOFR, 90-day Average SOFR, FFELP ABS fallback, FHFA-regulated-entity contract, consumer loan LIBOR fallback, "what does 3-month LIBOR become", "SOFR plus 26 bp", legacy LIBOR swap repapering, synthetic LIBOR. SKIP for computing a compounded SOFR coupon and its lookback conventions (sofr-and-rfr-compounding), for building an OIS curve (ois-discounting-and-multi-curve), and for US settlement and calendar rules (../../../fin-core/skills/us-market-rules)./sofr-and-rfr-compoundingCompute a compounded-in-arrears overnight rate correctly - SOFR, SONIA, ESTR, TONA, SARON - including the lookback, lockout and observation-shift conventions. TRIGGER - SOFR compounded in arrears, SOFR Index, SOFR Averages, 30-day 90-day 180-day SOFR average, compounded RFR, daily compounding of an overnight rate, lookback, rate shift, observation shift, lockout, payment delay, "my SOFR coupon is a few basis points off", "compounded vs simple average SOFR", ACT/360 vs ACT/365 on SONIA, SONIA Compounded Index, ESTR, TONA, SARON, OvernightIndexedCoupon, RateAveraging.Compound, applyObservationShift, SOFRINDEX, SOFR30DAYAVG. SKIP for what a LIBOR contract falls back TO and the statutory spreads (libor-transition-and-fallbacks), for building an OIS discount curve (ois-discounting-and-multi-curve), for a floater's duration (duration-convexity-and-dv01), and for bond accrued interest and day counts (bond-conventions-and-accrued)./yield-measures-and-bill-quotesTurn a bond or bill price into the right yield, and stop treating a discount rate as one. TRIGGER - yield to maturity, YTM, current yield, yield to call, yield to worst, YTW, running yield, redemption yield; Treasury bill discount rate vs bond-equivalent yield, BEY, coupon-equivalent yield, investment rate, "why is the 4-week bill rate different from the yield", DTB3 vs DGS3MO, 360 vs 365 on a bill, money-market yield, add-on rate, CD equivalent; "my yield does not match Bloomberg", BondFunctions.bondYield, brentq on a bond price, callable bond yield. SKIP for accrued interest and day-count choice (bond-conventions-and-accrued), for negative accrued in a gilt ex-dividend window (ex-dividend-and-rebate-interest), for duration DV01 and convexity (duration-convexity-and-dv01), for zero rates and bootstrapping (../../../fin-models/skills/term-structure-models), and for compounded RFR averages (sofr-and-rfr-compounding)./fin-fixed-income:ois-discounting-and-multi-curvefrom fin-fixed-income
npx claudepluginhub howard-lynn-ye/fin-rsi --plugin fin-fixed-income