Skip to content

Deprecate day-counter argument in z-spread functions#2465

Merged
lballabio merged 1 commit intolballabio:masterfrom
zippyg:fix/zspread-daycount
Mar 4, 2026
Merged

Deprecate day-counter argument in z-spread functions#2465
lballabio merged 1 commit intolballabio:masterfrom
zippyg:fix/zspread-daycount

Conversation

@zippyg
Copy link
Copy Markdown
Contributor

@zippyg zippyg commented Mar 2, 2026

Since commit 5cb1bff ("Remove day counter argument from spreaded
curves"), ZeroSpreadedTermStructure ignores the day counter it is
given and always delegates to the underlying curve's. However, the
higher-level APIs still exposed a DayCounter parameter that had
silently become a no-op:

  • CashFlows::npv() (z-spread overload)
  • CashFlows::zSpread()
  • BondFunctions::cleanPrice(), dirtyPrice(), zSpread() (z-spread overloads)

This adds new primary overloads without the DayCounter argument and
marks the old signatures [[deprecated]] (version 1.42), following the
same pattern used in 5cb1bff for ZeroSpreadedTermStructure itself.
Internal callers in the test suite are updated accordingly.

Fixes #2278.

Since commit 5cb1bff ("Remove day counter argument from spreaded
curves"), ZeroSpreadedTermStructure ignores any day counter it is given
and always delegates to the underlying curve's day counter.  However,
the higher-level APIs that build that structure internally still exposed
a DayCounter parameter that had become a no-op:

- CashFlows::npv() (z-spread overload)
- CashFlows::zSpread()
- BondFunctions::cleanPrice() (z-spread overload)
- BondFunctions::dirtyPrice() (z-spread overload)
- BondFunctions::zSpread()

Add new primary overloads without the DayCounter argument and mark the
old signatures [[deprecated]] ("Deprecated in version 1.42"), following
the same pattern used in 5cb1bff for ZeroSpreadedTermStructure itself.
The deprecated overloads are one-line delegates to the new primaries.

Update all internal callers in test-suite/bonds.cpp and
test-suite/assetswap.cpp to use the new overloads.  Remove the stale
"to be fixed" comment in zerospreadedtermstructure.hpp.

Fixes lballabio#2278.
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 74.24% (-0.01%) from 74.253%
when pulling 098ffa6 on zippyg:fix/zspread-daycount
into 2660398 on lballabio:master.

@lballabio lballabio added this to the Release 1.42 milestone Mar 4, 2026
@lballabio lballabio merged commit 53772dc into lballabio:master Mar 4, 2026
43 checks passed
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.

Potential day count bug in ZeroSpreadedTermStructure / zSpread

3 participants