diff --git a/ql/termstructures/yield/oisratehelper.cpp b/ql/termstructures/yield/oisratehelper.cpp index 56b895d149..035cc34227 100644 --- a/ql/termstructures/yield/oisratehelper.cpp +++ b/ql/termstructures/yield/oisratehelper.cpp @@ -50,7 +50,8 @@ namespace QuantLib { Natural lockoutDays, bool applyObservationShift, ext::shared_ptr pricer, - DateGeneration::Rule rule) + DateGeneration::Rule rule, + Calendar overnightCalendar) : RelativeDateRateHelper(fixedRate), settlementDays_(settlementDays), tenor_(tenor), discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates), paymentLag_(paymentLag), paymentConvention_(paymentConvention), @@ -58,8 +59,8 @@ namespace QuantLib { forwardStart_(forwardStart), overnightSpread_(handleFromVariant(overnightSpread)), pillarChoice_(pillar), averagingMethod_(averagingMethod), endOfMonth_(endOfMonth), fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(std::move(fixedCalendar)), - lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), applyObservationShift_(applyObservationShift), - pricer_(std::move(pricer)), rule_(rule) { + overnightCalendar_(std::move(overnightCalendar)), lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), + applyObservationShift_(applyObservationShift), pricer_(std::move(pricer)), rule_(rule) { initialize(overnightIndex, customPillarDate); } @@ -84,7 +85,8 @@ namespace QuantLib { Natural lockoutDays, bool applyObservationShift, ext::shared_ptr pricer, - DateGeneration::Rule rule) + DateGeneration::Rule rule, + Calendar overnightCalendar) : RelativeDateRateHelper(fixedRate, false), startDate_(startDate), endDate_(endDate), discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates), paymentLag_(paymentLag), paymentConvention_(paymentConvention), @@ -92,8 +94,8 @@ namespace QuantLib { overnightSpread_(handleFromVariant(overnightSpread)), pillarChoice_(pillar), averagingMethod_(averagingMethod), endOfMonth_(endOfMonth), fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(std::move(fixedCalendar)), - lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), applyObservationShift_(applyObservationShift), - pricer_(std::move(pricer)), rule_(rule) { + overnightCalendar_(std::move(overnightCalendar)), lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), + applyObservationShift_(applyObservationShift), pricer_(std::move(pricer)), rule_(rule) { initialize(overnightIndex, customPillarDate); } @@ -144,6 +146,9 @@ namespace QuantLib { if (!fixedCalendar_.empty()) { tmp.withFixedLegCalendar(fixedCalendar_); } + if (!overnightCalendar_.empty()) { + tmp.withOvernightLegCalendar(overnightCalendar_); + } swap_ = tmp; if (pricer_) diff --git a/ql/termstructures/yield/oisratehelper.hpp b/ql/termstructures/yield/oisratehelper.hpp index 127d5c53a2..5b554c073d 100644 --- a/ql/termstructures/yield/oisratehelper.hpp +++ b/ql/termstructures/yield/oisratehelper.hpp @@ -60,7 +60,8 @@ namespace QuantLib { Natural lockoutDays = 0, bool applyObservationShift = false, ext::shared_ptr pricer = {}, - DateGeneration::Rule rule = DateGeneration::Backward); + DateGeneration::Rule rule = DateGeneration::Backward, + Calendar overnightCalendar = Calendar()); OISRateHelper(const Date& startDate, const Date& endDate, @@ -84,7 +85,8 @@ namespace QuantLib { Natural lockoutDays = 0, bool applyObservationShift = false, ext::shared_ptr pricer = {}, - DateGeneration::Rule rule = DateGeneration::Backward); + DateGeneration::Rule rule = DateGeneration::Backward, + Calendar overnightCalendar = Calendar()); //! \name RateHelper interface //@{ @@ -128,6 +130,7 @@ namespace QuantLib { ext::optional endOfMonth_; ext::optional fixedPaymentFrequency_; Calendar fixedCalendar_; + Calendar overnightCalendar_; Natural lookbackDays_; Natural lockoutDays_; bool applyObservationShift_;