From 03276a23b68f7e5a87449f369d23d4a223f252a9 Mon Sep 17 00:00:00 2001 From: Farah Khashman Date: Tue, 19 Mar 2024 15:26:13 -0400 Subject: [PATCH] QPR-12101: support payment lag for CMSSpread leg --- ql/experimental/coupons/cmsspreadcoupon.cpp | 10 ++++++++-- ql/experimental/coupons/cmsspreadcoupon.hpp | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ql/experimental/coupons/cmsspreadcoupon.cpp b/ql/experimental/coupons/cmsspreadcoupon.cpp index d65cdebd89e..d3d67153375 100644 --- a/ql/experimental/coupons/cmsspreadcoupon.cpp +++ b/ql/experimental/coupons/cmsspreadcoupon.cpp @@ -72,6 +72,12 @@ namespace QuantLib { return *this; } + CmsSpreadLeg & + CmsSpreadLeg::withPaymentLag(Natural lag) { + paymentLag_ = lag; + return *this; + } + CmsSpreadLeg &CmsSpreadLeg::withFixingDays(Natural fixingDays) { fixingDays_ = std::vector(1, fixingDays); return *this; @@ -137,12 +143,12 @@ namespace QuantLib { CmsSpreadLeg& CmsSpreadLeg::withPaymentCalendar(const Calendar& cal) { paymentCalendar_ = cal; return *this; - } + } CmsSpreadLeg::operator Leg() const { return FloatingLeg( schedule_, notionals_, swapSpreadIndex_, paymentDayCounter_, paymentAdjustment_, - fixingDays_, gearings_, spreads_, caps_, floors_, inArrears_, zeroPayments_, 0U, + fixingDays_, gearings_, spreads_, caps_, floors_, inArrears_, zeroPayments_, paymentLag_, paymentCalendar_); } } diff --git a/ql/experimental/coupons/cmsspreadcoupon.hpp b/ql/experimental/coupons/cmsspreadcoupon.hpp index 945192999af..3ba5aeda231 100644 --- a/ql/experimental/coupons/cmsspreadcoupon.hpp +++ b/ql/experimental/coupons/cmsspreadcoupon.hpp @@ -108,6 +108,7 @@ namespace QuantLib { CmsSpreadLeg& withPaymentDayCounter(const DayCounter&); CmsSpreadLeg& withPaymentCalendar(const Calendar& cal); CmsSpreadLeg& withPaymentAdjustment(BusinessDayConvention); + CmsSpreadLeg& withPaymentLag(Natural lag); CmsSpreadLeg& withFixingDays(Natural fixingDays); CmsSpreadLeg& withFixingDays(const std::vector& fixingDays); CmsSpreadLeg& withGearings(Real gearing); @@ -127,6 +128,7 @@ namespace QuantLib { std::vector notionals_; DayCounter paymentDayCounter_; BusinessDayConvention paymentAdjustment_ = Following; + Natural paymentLag_ = 0; std::vector fixingDays_; std::vector gearings_; std::vector spreads_;