Skip to content

Commit

Permalink
Add date generation rule to OISRateHelper constructor (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio authored Nov 2, 2024
2 parents a6378c5 + de190cc commit ea7e1e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions ql/termstructures/yield/oisratehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace QuantLib {
Natural lookbackDays,
Natural lockoutDays,
bool applyObservationShift,
ext::shared_ptr<FloatingRateCouponPricer> pricer)
ext::shared_ptr<FloatingRateCouponPricer> pricer,
DateGeneration::Rule rule)
: RelativeDateRateHelper(fixedRate), settlementDays_(settlementDays), tenor_(tenor),
discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates),
paymentLag_(paymentLag), paymentConvention_(paymentConvention),
Expand All @@ -58,7 +59,7 @@ namespace QuantLib {
averagingMethod_(averagingMethod), endOfMonth_(endOfMonth),
fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(std::move(fixedCalendar)),
lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), applyObservationShift_(applyObservationShift),
pricer_(std::move(pricer)) {
pricer_(std::move(pricer)), rule_(rule) {
initialize(overnightIndex, customPillarDate);
}

Expand All @@ -82,7 +83,8 @@ namespace QuantLib {
Natural lookbackDays,
Natural lockoutDays,
bool applyObservationShift,
ext::shared_ptr<FloatingRateCouponPricer> pricer)
ext::shared_ptr<FloatingRateCouponPricer> pricer,
DateGeneration::Rule rule)
: RelativeDateRateHelper(fixedRate, false), startDate_(startDate), endDate_(endDate),
discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates),
paymentLag_(paymentLag), paymentConvention_(paymentConvention),
Expand All @@ -91,7 +93,7 @@ namespace QuantLib {
averagingMethod_(averagingMethod), endOfMonth_(endOfMonth),
fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(std::move(fixedCalendar)),
lookbackDays_(lookbackDays), lockoutDays_(lockoutDays), applyObservationShift_(applyObservationShift),
pricer_(std::move(pricer)) {
pricer_(std::move(pricer)), rule_(rule) {
initialize(overnightIndex, customPillarDate);
}

Expand Down Expand Up @@ -128,6 +130,7 @@ namespace QuantLib {
.withAveragingMethod(averagingMethod_)
.withLookbackDays(lookbackDays_)
.withLockoutDays(lockoutDays_)
.withRule(rule_)
.withObservationShift(applyObservationShift_);
if (endOfMonth_) {
tmp.withEndOfMonth(*endOfMonth_);
Expand Down
8 changes: 6 additions & 2 deletions ql/termstructures/yield/oisratehelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ namespace QuantLib {
Natural lookbackDays = Null<Natural>(),
Natural lockoutDays = 0,
bool applyObservationShift = false,
ext::shared_ptr<FloatingRateCouponPricer> pricer = {});
ext::shared_ptr<FloatingRateCouponPricer> pricer = {},
DateGeneration::Rule rule = DateGeneration::Backward);
OISRateHelper(const Date& startDate,
const Date& endDate,
const Handle<Quote>& fixedRate,
Expand All @@ -80,7 +81,8 @@ namespace QuantLib {
Natural lookbackDays = Null<Natural>(),
Natural lockoutDays = 0,
bool applyObservationShift = false,
ext::shared_ptr<FloatingRateCouponPricer> pricer = {});
ext::shared_ptr<FloatingRateCouponPricer> pricer = {},
DateGeneration::Rule rule = DateGeneration::Backward);
//! \name RateHelper interface
//@{
Real impliedQuote() const override;
Expand Down Expand Up @@ -127,6 +129,8 @@ namespace QuantLib {
Natural lockoutDays_;
bool applyObservationShift_;
ext::shared_ptr<FloatingRateCouponPricer> pricer_;
DateGeneration::Rule rule_ = DateGeneration::Backward;

};

/*! \deprecated Use OISRateHelper instead.
Expand Down

0 comments on commit ea7e1e4

Please sign in to comment.