Add MultipleResetsSwap instrument and rate helper#2474
Merged
lballabio merged 2 commits intolballabio:masterfrom Mar 13, 2026
Merged
Add MultipleResetsSwap instrument and rate helper#2474lballabio merged 2 commits intolballabio:masterfrom
lballabio merged 2 commits intolballabio:masterfrom
Conversation
6644ae4 to
d3def14
Compare
Implements issue lballabio#2138: a fixed-vs-floating swap whose floating leg coupons are determined by compounding or averaging multiple consecutive Ibor fixings within each accrual period. Adds MultipleResetsSwap (inheriting FixedVsFloatingSwap, giving fairRate(), fairSpread(), and BPS methods for free), a MakeMultipleResetsSwap fluent builder, and MultipleResetsSwapRateHelper for bootstrapping yield curves from multiple-resets swap quotes. The floating leg is built via the existing MultipleResetsLeg/coupon infrastructure. Tests cover fair-rate pricing, payer/receiver leg NPV consistency, averaging vs. compounding differentiation, and end-to-end bootstrapping at 1Y/2Y/3Y. Relates to lballabio#2138.
d3def14 to
6a18dc9
Compare
lballabio
reviewed
Mar 12, 2026
Owner
lballabio
left a comment
There was a problem hiding this comment.
Thanks! I left a few comments.
Comment on lines
+44
to
+45
| Rate fixedRate = Null<Rate>(), | ||
| const Period& fwdStart = 0 * Days); |
Owner
There was a problem hiding this comment.
Being optional, these two could be moved to corresponding with methods.
Comment on lines
+131
to
+140
| MakeMultipleResetsSwap& MakeMultipleResetsSwap::withSettlementDays(Natural settlementDays) { | ||
| settlementDays_ = settlementDays; | ||
| effectiveDate_ = Date(); | ||
| return *this; | ||
| } | ||
|
|
||
| MakeMultipleResetsSwap& MakeMultipleResetsSwap::withEffectiveDate(const Date& d) { | ||
| effectiveDate_ = d; | ||
| return *this; | ||
| } |
Owner
There was a problem hiding this comment.
There's a discussion going on about similar methods in other classes — see #1394. These might need to be modified in the same way.
| // Cross-check: fixed-leg NPV + floating-leg NPV equals total NPV. | ||
| Real npvCheck = swap->fixedLegNPV() + swap->floatingLegNPV(); | ||
| BOOST_CHECK_SMALL(npvCheck - swap->NPV(), 1.0e-10); | ||
| } |
Owner
There was a problem hiding this comment.
Here you could also check that, if you use MakeMultipleResetsSwap without passing a rate, you get back a fair swap.
Move fixedRate and fwdStart out of the constructor into withFixedRate() and withForwardStart() fluent methods, keeping the constructor to its three mandatory parameters. Add a QL_REQUIRE guard so that withEffectiveDate and withSettlementDays are mutually exclusive rather than silently overriding each other. Add a test for the auto-fair-rate path in MakeMultipleResetsSwap.
Contributor
Author
|
Thanks for the review, Luigi, implemented all three points:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements issue #2138: a fixed-vs-floating swap whose floating leg coupons are
determined by compounding or averaging multiple consecutive Ibor fixings within
each accrual period.
Adds MultipleResetsSwap (inheriting FixedVsFloatingSwap, giving fairRate(),
fairSpread(), and BPS methods for free), a MakeMultipleResetsSwap fluent builder,
and MultipleResetsSwapRateHelper for bootstrapping yield curves from
multiple-resets swap quotes. The floating leg is built via the existing
MultipleResetsLeg/coupon infrastructure. Tests cover fair-rate pricing,
payer/receiver leg NPV consistency, averaging vs. compounding differentiation,
and end-to-end bootstrapping at 1Y/2Y/3Y.
Relates to #2138.