Skip to content

gh-2172 fix bond yield over partial coupon periods - #10

Merged
pcaspers merged 1 commit into
pcaspers:yield_overhaulfrom
rich-amaya:gh-2172-yield-fractional-periods
Aug 22, 2026
Merged

gh-2172 fix bond yield over partial coupon periods#10
pcaspers merged 1 commit into
pcaspers:yield_overhaulfrom
rich-amaya:gh-2172-yield-fractional-periods

Conversation

@rich-amaya

Copy link
Copy Markdown

This builds on your yield_overhaul branch and picks up lballabiogh-2172.

The problem

Both hybrid conventions are positional. SimpleThenCompounded discounts the
first interval simply and compounds the rest. CompoundedThenSimple compounds
up to the last flow and discounts the final interval simply. When a bond
settled inside a partial period, neither rule landed on the interval the
convention names, so the yield came back wrong.

Duration and convexity had a related problem. They were not derivatives of the
price function that priced the bond, so a bump-and-reprice did not tie out to
the analytic numbers. They now come off the same stepwise discount factors as
the price.

How I checked it

Yields go against something independent, not against the code:

  • the final-period bond matches Excel and Bloomberg at 1.349867886%
  • the late-redemption bond matches a closed form solved independently
  • the long-first-coupon bonds round trip from price back to the 5% yield

Sensitivities go against central finite differences of the dirty price at 1bp.

The late-redemption bond is the one that earns its keep. Moving the redemption
three days past the final coupon leaves a genuinely short terminal interval,
where simple and compounded actually part ways: modified duration is 0.249076
under STC and 0.248319 under CTS. Without that gap the sensitivity tests would
pass on a broken CTS implementation.

Full suite is green.

Two things I left alone

bps(leg, InterestRate) still discounts through a FlatForward curve, so it
disagrees with npv, duration and convexity under both hybrid conventions.
Fixing it changes public behaviour, so I would rather you make that call.

CashFlows::npv and the new cashFlowResults share the convention helpers but
keep separate loops. Merging them puts derivative work on the yield solver's
hot path, which seemed a bad trade.

Use the right compounding over short first and final periods, and make
duration and convexity match the price they come from. Adds tests for
long first coupons, quasi-periods, and late redemption.
@pcaspers
pcaspers merged commit fd150d0 into pcaspers:yield_overhaul Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants