Skip to content

Commit 3d2ae0b

Browse files
committed
QPR-13777 fix deprecated warnings after QL upgrade
1 parent 6cc5cac commit 3d2ae0b

8 files changed

Lines changed: 24 additions & 20 deletions

File tree

OREAnalytics/orea/scenario/scenariosimmarket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2636,7 +2636,7 @@ ScenarioSimMarket::ScenarioSimMarket(
26362636
}
26372637

26382638
for (Size i = 1; i < yoyCurveTimes.size(); i++) {
2639-
Real rate = yoyInflationTs->yoyRate(quoteDates[i - 1], yoyInflationTs->observationLag());
2639+
Real rate = yoyInflationTs->yoyRate(quoteDates[i - 1] - yoyInflationTs->observationLag());
26402640
auto q = QuantLib::ext::make_shared<SimpleQuote>(useSpreadedTermStructures_ ? 0.0 : rate);
26412641
if (i == 1) {
26422642
// add the zero rate at first tenor to the T0 time, to ensure flat interpolation of T1

OREAnalytics/test/saccr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ class LocalTestMarket : public MarketImpl {
264264
Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(ratesZCII[i] / 100.0)));
265265
QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>> anInstrument(
266266
new ZeroCouponInflationSwapHelper(
267-
quote, Period(2, Months), datesZCII[i], UnitedKingdom(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii,
268-
CPI::AsIndex, yieldCurves_.at(make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP"))));
267+
quote, Period(2, Months), asof_,datesZCII[i], UnitedKingdom(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii,
268+
CPI::AsIndex));
269269
;
270270
instruments.push_back(anInstrument);
271271
};

OREData/ored/marketdata/inflationcurve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ InflationCurve::InflationCurve(Date asof, InflationCurveSpec spec, const Loader&
132132
calInfo->baseDate = curve_->baseDate();
133133
for (Size i = 0; i < pillarDates.size(); ++i) {
134134
calInfo->pillarDates.push_back(pillarDates[i]);
135-
calInfo->yoyRates.push_back(yoyCurve->yoyRate(pillarDates[i], 0 * Days));
135+
calInfo->yoyRates.push_back(yoyCurve->yoyRate(pillarDates[i]));
136136
calInfo->times.push_back(yoyCurve->timeFromReference(pillarDates[i]));
137137
if (!results.mdQuoteLabels.empty() && !overwrittenPillarDates) {
138138
calInfo->mdQuoteLabels.push_back(results.mdQuoteLabels[i]);

OREData/ored/model/utilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ Real yoyCapFloorStrikeValue(const QuantLib::ext::shared_ptr<BaseStrike>& strike,
517517
} else if (auto atm = QuantLib::ext::dynamic_pointer_cast<AtmStrike>(strike)) {
518518
QL_REQUIRE(atm->atmType() == DeltaVolQuote::AtmFwd,
519519
"only atm forward allowed as atm strike for cpi cap floors");
520-
return curve->yoyRate(optionMaturityDate, curve->observationLag());
520+
return curve->yoyRate(optionMaturityDate - curve->observationLag());
521521
} else {
522522
QL_FAIL("yoy cap floor strike type not supported, expected absolute strike or atm fwd strike, got '"
523523
<< strike->toString());

OREData/test/cpiswap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ class TestMarket : public MarketImpl {
143143
Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(ratesZCII[i] / 100.0)));
144144
QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>> anInstrument(
145145
new ZeroCouponInflationSwapHelper(
146-
quote, Period(2, Months), datesZCII[i], UnitedKingdom(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii,
147-
CPI::AsIndex, yieldCurves_.at(make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP"))));
146+
quote, Period(2, Months), asof_, datesZCII[i], UnitedKingdom(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii,
147+
CPI::AsIndex));
148148
;
149149
instruments.push_back(anInstrument);
150150
};

QuantExt/qle/pricingengines/inflationcapfloorengines.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ void YoYInflationCapFloorEngine::calculate() const {
6969
// This also means that we do not need the coupon to have
7070
// a pricing engine to return the swaplet rate and then
7171
// the adjusted fixing in the instrument.
72-
forwards[i] = yoyTS->yoyRate(arguments_.fixingDates[i], Period(0, Days));
72+
73+
forwards[i] = yoyTS->yoyRate(arguments_.fixingDates[i]);
7374
Rate forward = forwards[i];
7475

7576
Date fixingDate = arguments_.fixingDates[i];

QuantExt/qle/termstructures/interpolatedyoycapfloortermpricesurface.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ class InterpolatedYoYCapFloorTermPriceSurface : public YoYCapFloorTermPriceSurfa
7676
virtual Rate atmYoYSwapRate(const Date& d, bool extrapolate = true) const override {
7777
return atmYoYSwapRateCurve_(timeFromReference(d), extrapolate);
7878
}
79+
7980
virtual Rate atmYoYRate(const Date& d, const Period& obsLag = Period(-1, Days), bool extrapolate = true) const override {
8081
// work in terms of maturity-of-instruments
8182
// so ask for rate with observation lag
8283
// Third parameter = force linear interpolation of yoy
83-
return yoy_->yoyRate(d, obsLag, false, extrapolate);
84+
Period relevantObsLag = obsLag == Period(-1, Days) ? yoy_->observationLag() : obsLag;
85+
return yoy_->yoyRate(d - relevantObsLag, extrapolate);
8486
}
8587
//@}
8688

@@ -231,7 +233,8 @@ template <class I2D, class I1D> void InterpolatedYoYCapFloorTermPriceSurface<I2D
231233
for (Size k = 0; k < numYears; ++k)
232234
sumDiscount += nominalTS_->discount(k + 1.0);
233235

234-
Real S = yoy_->yoyRate(yoyOptionDateFromTenor(mat), observationLag());
236+
auto relevantObsLag = observationLag() == Period(-1, Days) ? yoy_->observationLag() : observationLag();
237+
Real S = yoy_->yoyRate(yoyOptionDateFromTenor(mat) - relevantObsLag);
235238
for (Size i = 0; i < cfStrikes_.size(); ++i) {
236239
Real K = cfStrikes_[i];
237240
// Real K = std::pow(1.0 + K_quote, mat.length());

QuantExt/test/cpicapfloor.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,19 @@ BOOST_FIXTURE_TEST_SUITE(QuantExtTestSuite, qle::test::TopLevelFixture)
6565

6666
BOOST_AUTO_TEST_SUITE(CPICapFloorTest)
6767

68-
template <class T, class U, class I>
69-
std::vector<QuantLib::ext::shared_ptr<BootstrapHelper<T> > > makeHelpers(Datum iiData[], Size N, const QuantLib::ext::shared_ptr<I>& ii,
68+
69+
std::vector<QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>>> makeHelpers(Datum iiData[], Size N, const QuantLib::ext::shared_ptr<ZeroInflationIndex>& ii,
70+
Date startDate,
7071
const Period& observationLag, const Calendar& calendar,
71-
const BusinessDayConvention& bdc, const DayCounter& dc,
72-
Handle<YieldTermStructure> yts) {
72+
const BusinessDayConvention& bdc, const DayCounter& dc) {
7373

74-
std::vector<QuantLib::ext::shared_ptr<BootstrapHelper<T> > > instruments;
74+
std::vector<QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure> > > instruments;
7575
for (Size i = 0; i < N; i++) {
7676
Date maturity = iiData[i].date;
7777
Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(iiData[i].rate / 100.0)));
78-
QuantLib::ext::shared_ptr<BootstrapHelper<T> > anInstrument(
79-
new U(quote, observationLag, maturity, calendar, bdc, dc, ii, CPI::AsIndex, yts));
78+
QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>> anInstrument =
79+
ext::make_shared<ZeroCouponInflationSwapHelper>(quote, observationLag, startDate, maturity, calendar, bdc,
80+
dc, ii, CPI::AsIndex);
8081
instruments.push_back(anInstrument);
8182
}
8283

@@ -233,9 +234,8 @@ struct CommonVars {
233234

234235
// now build the helpers ...
235236
std::vector<QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure> > > helpers =
236-
makeHelpers<ZeroInflationTermStructure, ZeroCouponInflationSwapHelper, ZeroInflationIndex>(
237-
zciisData, zciisDataLength, ii, observationLag, calendar, convention, dcZCIIS,
238-
Handle<YieldTermStructure>(nominalTS));
237+
makeHelpers(
238+
zciisData, zciisDataLength, ii, today, observationLag, calendar, convention, dcZCIIS);
239239

240240
// we can use historical or first ZCIIS for this
241241
// we know historical is WAY off market-implied, so use market implied flat.

0 commit comments

Comments
 (0)