Skip to content

Commit f276b2d

Browse files
committed
QPR-13768 use forward schedule, fix settlement days default
1 parent 44d02c0 commit f276b2d

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

QuantExt/qle/instruments/makeoiscapfloor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MakeOISCapFloor::MakeOISCapFloor(CapFloor::Type type, const Period& tenor, const
2626
const Period& rateComputationPeriod, Rate strike,
2727
const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve)
2828
: type_(type), tenor_(tenor), index_(index), rateComputationPeriod_(rateComputationPeriod), strike_(strike),
29-
nominal_(1.0), settlementDays_(2), calendar_(index->fixingCalendar()), convention_(ModifiedFollowing),
29+
nominal_(1.0), settlementDays_(0), calendar_(index->fixingCalendar()), convention_(ModifiedFollowing),
3030
rule_(DateGeneration::Backward), dayCounter_(index->dayCounter()), telescopicValueDates_(false),
3131
discountCurve_(discountCurve) {}
3232

@@ -43,8 +43,8 @@ MakeOISCapFloor::operator Leg() const {
4343

4444
Date endDate = calendar.adjust(startDate + tenor_, ModifiedFollowing);
4545

46-
Schedule schedule(startDate, endDate, rateComputationPeriod_, calendar, ModifiedFollowing, ModifiedFollowing,
47-
DateGeneration::Backward, false);
46+
Schedule schedule(startDate, endDate, rateComputationPeriod_, calendar, ModifiedFollowing, ModifiedFollowing, rule_,
47+
false);
4848

4949
// determine atm strike if required
5050
Real effectiveStrike = strike_;

QuantExt/qle/termstructures/oiscapfloorhelper.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ void OISCapFloorHelper::initializeDates() {
7777
Rate dummyStrike = strike_ == Null<Real>() ? 0.01 : strike_;
7878
capFloor_ = MakeOISCapFloor(capFloorType, tenor_, index_, rateComputationPeriod_, dummyStrike)
7979
.withEffectiveDate(effectiveDate_)
80-
.withTelescopicValueDates(true);
80+
.withTelescopicValueDates(true)
81+
.withRule(DateGeneration::Rule::Forward);
8182
capFloorCopy_ = MakeOISCapFloor(capFloorType, tenor_, index_, rateComputationPeriod_, dummyStrike)
8283
.withEffectiveDate(effectiveDate_)
83-
.withTelescopicValueDates(true);
84+
.withTelescopicValueDates(true)
85+
.withRule(DateGeneration::Rule::Forward);
8486

8587
QL_REQUIRE(!capFloor_.empty(), "OISCapFloorHelper: got empty leg.");
8688

@@ -108,10 +110,12 @@ void OISCapFloorHelper::setTermStructure(OptionletVolatilityStructure* ovts) {
108110
CapFloor::Type capFloorType = type_ == CapFloorHelper::Cap ? CapFloor::Cap : CapFloor::Floor;
109111
capFloor_ = MakeOISCapFloor(capFloorType, tenor_, index_, rateComputationPeriod_, atm)
110112
.withTelescopicValueDates(true)
111-
.withEffectiveDate(effectiveDate_);
113+
.withEffectiveDate(effectiveDate_)
114+
.withRule(DateGeneration::Rule::Forward);
112115
capFloorCopy_ = MakeOISCapFloor(capFloorType, tenor_, index_, rateComputationPeriod_, atm)
113-
.withTelescopicValueDates(true)
114-
.withEffectiveDate(effectiveDate_);
116+
.withTelescopicValueDates(true)
117+
.withEffectiveDate(effectiveDate_)
118+
.withRule(DateGeneration::Rule::Forward);
115119
} else if (type_ == CapFloorHelper::Automatic && quoteType_ != CapFloorHelper::Premium) {
116120
// If the helper is set to automatically choose the underlying instrument type, do it now based on the ATM rate
117121
Rate atm = CashFlows::atmRate(getOisCapFloorUnderlying(capFloor_), **discountHandle_, false);
@@ -121,7 +125,9 @@ void OISCapFloorHelper::setTermStructure(OptionletVolatilityStructure* ovts) {
121125
.withEffectiveDate(effectiveDate_);
122126
capFloorCopy_ = MakeOISCapFloor(capFloorType, tenor_, index_, rateComputationPeriod_, strike_)
123127
.withTelescopicValueDates(true)
124-
.withEffectiveDate(effectiveDate_);
128+
.withEffectiveDate(effectiveDate_)
129+
.withRule(DateGeneration::Rule::Forward);
130+
125131
for (auto const& c : capFloor_) {
126132
auto cpn = QuantLib::ext::dynamic_pointer_cast<Coupon>(c);
127133
}

0 commit comments

Comments
 (0)