Skip to content

Commit e73b929

Browse files
committed
Expose overnight calendar in OISRateHelper
1 parent 46a3903 commit e73b929

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

ql/termstructures/yield/oisratehelper.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,17 @@ namespace QuantLib {
5050
Natural lockoutDays,
5151
bool applyObservationShift,
5252
ext::shared_ptr<FloatingRateCouponPricer> pricer,
53-
DateGeneration::Rule rule)
53+
DateGeneration::Rule rule,
54+
Calendar overnightCalendar)
5455
: RelativeDateRateHelper(fixedRate), settlementDays_(settlementDays), tenor_(tenor),
5556
discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates),
5657
paymentLag_(paymentLag), paymentConvention_(paymentConvention),
5758
paymentFrequency_(paymentFrequency), paymentCalendar_(std::move(paymentCalendar)),
5859
forwardStart_(forwardStart), overnightSpread_(handleFromVariant(overnightSpread)), pillarChoice_(pillar),
5960
averagingMethod_(averagingMethod), endOfMonth_(endOfMonth),
6061
fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(std::move(fixedCalendar)),
61-
lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), applyObservationShift_(applyObservationShift),
62-
pricer_(std::move(pricer)), rule_(rule) {
62+
overnightCalendar_(std::move(overnightCalendar)), lookbackDays_(lookbackDays), lockoutDays_(lockoutDays),
63+
applyObservationShift_(applyObservationShift), pricer_(std::move(pricer)), rule_(rule) {
6364
initialize(overnightIndex, customPillarDate);
6465
}
6566

@@ -84,16 +85,17 @@ namespace QuantLib {
8485
Natural lockoutDays,
8586
bool applyObservationShift,
8687
ext::shared_ptr<FloatingRateCouponPricer> pricer,
87-
DateGeneration::Rule rule)
88+
DateGeneration::Rule rule,
89+
Calendar overnightCalendar)
8890
: RelativeDateRateHelper(fixedRate, false), startDate_(startDate), endDate_(endDate),
8991
discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates),
9092
paymentLag_(paymentLag), paymentConvention_(paymentConvention),
9193
paymentFrequency_(paymentFrequency), paymentCalendar_(std::move(paymentCalendar)),
9294
overnightSpread_(handleFromVariant(overnightSpread)), pillarChoice_(pillar),
9395
averagingMethod_(averagingMethod), endOfMonth_(endOfMonth),
9496
fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(std::move(fixedCalendar)),
95-
lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), applyObservationShift_(applyObservationShift),
96-
pricer_(std::move(pricer)), rule_(rule) {
97+
overnightCalendar_(std::move(overnightCalendar)), lookbackDays_(lookbackDays), lockoutDays_(lockoutDays),
98+
applyObservationShift_(applyObservationShift), pricer_(std::move(pricer)), rule_(rule) {
9799
initialize(overnightIndex, customPillarDate);
98100
}
99101

@@ -144,6 +146,9 @@ namespace QuantLib {
144146
if (!fixedCalendar_.empty()) {
145147
tmp.withFixedLegCalendar(fixedCalendar_);
146148
}
149+
if (!overnightCalendar_.empty()) {
150+
tmp.withOvernightLegCalendar(overnightCalendar_);
151+
}
147152
swap_ = tmp;
148153

149154
if (pricer_)

ql/termstructures/yield/oisratehelper.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ namespace QuantLib {
6060
Natural lockoutDays = 0,
6161
bool applyObservationShift = false,
6262
ext::shared_ptr<FloatingRateCouponPricer> pricer = {},
63-
DateGeneration::Rule rule = DateGeneration::Backward);
63+
DateGeneration::Rule rule = DateGeneration::Backward,
64+
Calendar overnightCalendar = Calendar());
6465

6566
OISRateHelper(const Date& startDate,
6667
const Date& endDate,
@@ -84,7 +85,8 @@ namespace QuantLib {
8485
Natural lockoutDays = 0,
8586
bool applyObservationShift = false,
8687
ext::shared_ptr<FloatingRateCouponPricer> pricer = {},
87-
DateGeneration::Rule rule = DateGeneration::Backward);
88+
DateGeneration::Rule rule = DateGeneration::Backward,
89+
Calendar overnightCalendar = Calendar());
8890

8991
//! \name RateHelper interface
9092
//@{
@@ -128,6 +130,7 @@ namespace QuantLib {
128130
ext::optional<bool> endOfMonth_;
129131
ext::optional<Frequency> fixedPaymentFrequency_;
130132
Calendar fixedCalendar_;
133+
Calendar overnightCalendar_;
131134
Natural lookbackDays_;
132135
Natural lockoutDays_;
133136
bool applyObservationShift_;

0 commit comments

Comments
 (0)