Skip to content

Commit

Permalink
QPR-12101: support payment lag for CMSSpread leg
Browse files Browse the repository at this point in the history
  • Loading branch information
Farah Khashman committed Mar 19, 2024
1 parent 0fd143c commit 03276a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ql/experimental/coupons/cmsspreadcoupon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Natural>(1, fixingDays);
return *this;
Expand Down Expand Up @@ -137,12 +143,12 @@ namespace QuantLib {
CmsSpreadLeg& CmsSpreadLeg::withPaymentCalendar(const Calendar& cal) {
paymentCalendar_ = cal;
return *this;
}
}

CmsSpreadLeg::operator Leg() const {
return FloatingLeg<SwapSpreadIndex, CmsSpreadCoupon, CappedFlooredCmsSpreadCoupon>(
schedule_, notionals_, swapSpreadIndex_, paymentDayCounter_, paymentAdjustment_,
fixingDays_, gearings_, spreads_, caps_, floors_, inArrears_, zeroPayments_, 0U,
fixingDays_, gearings_, spreads_, caps_, floors_, inArrears_, zeroPayments_, paymentLag_,
paymentCalendar_);
}
}
2 changes: 2 additions & 0 deletions ql/experimental/coupons/cmsspreadcoupon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Natural>& fixingDays);
CmsSpreadLeg& withGearings(Real gearing);
Expand All @@ -127,6 +128,7 @@ namespace QuantLib {
std::vector<Real> notionals_;
DayCounter paymentDayCounter_;
BusinessDayConvention paymentAdjustment_ = Following;
Natural paymentLag_ = 0;
std::vector<Natural> fixingDays_;
std::vector<Real> gearings_;
std::vector<Spread> spreads_;
Expand Down

0 comments on commit 03276a2

Please sign in to comment.