QuantLib icon indicating copy to clipboard operation
QuantLib copied to clipboard

MultipleResetsSwap instrument and rate helper

Open eltoder opened this issue 11 months ago • 7 comments

QuantLib now has MultipleResetsCoupon and MultipleResetsLeg, but it does not provide a ready-made instrument that uses these or a rate helper that can be used to bootstrap a curve using such instruments. That should be easy to add, but I have a question -- should these be added as new classes or as an option into VanillaSwap (or another existing instrument)?

The downside of the former is more code duplication, for example, I'd probably need a MakeMultipleResetsSwap class copy-pasted from MakeVanillaSwap, MultipleResetsSwapRateHelper copy-pasted from SwapRateHelper etc. The downside of the latter is that it will break code that expects VanillaSwap to always have IborCoupons.

eltoder avatar Jan 16 '25 17:01 eltoder

Hi—I don't know if I would create a specific instrument. It's easy enough to call MultipleResetsLeg and pass the resulting leg to the generic Bond or Swap constructor. As for the helper, are these swaps actually quoted?

lballabio avatar Feb 06 '25 11:02 lballabio

Yes, for example CDOR used to have semiannual swaps on the 3M index.

eltoder avatar Feb 06 '25 15:02 eltoder

Hi -- there are CNY swaps with weekly resets averaged into quarterly payments. Also, I believe that USD LIBOR tenor basis swaps historically used to compound up resets on the shorter tenor leg so that both legs had the same payment frequency.

sdacek avatar Feb 06 '25 19:02 sdacek

Another use case just posted at https://sourceforge.net/p/quantlib/mailman/message/59165941/.

I'd probably go for different classes. Parameters such as the schedules have different meaning in this case, so trying to adapt the existing classes might lead to confusion...

lballabio avatar Mar 27 '25 14:03 lballabio

@lballabio I believe this is exactly the one I mentioned in https://github.com/lballabio/QuantLib/issues/2138#issuecomment-2640099540 :-)

Also, FWIW, ORE has these as separate classes for the swap and the helper, but it does appear to involve a fair amount of boilerplate. And worse, it still has the bug you described in your blog post.

eltoder avatar Mar 27 '25 15:03 eltoder

@lballabio I believe this is exactly the one I mentioned in #2138 (comment) :-)

You're right, I read Stephen's comment on CNY but missed yours. Let's call it a confirmation of your use case, then :)

lballabio avatar Mar 27 '25 15:03 lballabio

This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.

github-actions[bot] avatar May 27 '25 02:05 github-actions[bot]