Skip to content

Commit ab0fda6

Browse files
committed
QPR-13777 update to QL 1.41 (work in progress)
1 parent 41002a2 commit ab0fda6

45 files changed

Lines changed: 129 additions & 142 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

OREAnalytics/orea/app/dummymarketdataloader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#pragma once
2424

2525
#include <orea/app/marketdataloader.hpp>
26-
#include <ql/tuple.hpp>
26+
#include <tuple>
2727

2828
namespace ore {
2929
namespace analytics {

OREAnalytics/orea/engine/parsensitivityinstrumentbuilder.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,11 +1798,9 @@ QuantLib::ext::shared_ptr<Instrument> ParSensitivityInstrumentBuilder::makeYoyIn
17981798
discountCurve = market->discountCurve(ccy, marketConfiguration);
17991799
}
18001800
}
1801-
QL_DEPRECATED_DISABLE_WARNING
18021801
QuantLib::ext::shared_ptr<YearOnYearInflationSwap> helper(new YearOnYearInflationSwap(
18031802
YearOnYearInflationSwap::Payer, 1.0, fixSchedule, 0.0, conv->dayCounter(), yoySchedule, index,
1804-
conv->observationLag(), 0.0, conv->dayCounter(), conv->infCalendar()));
1805-
QL_DEPRECATED_ENABLE_WARNING
1803+
conv->observationLag(), QuantLib::CPI::AsIndex, 0.0, conv->dayCounter(), conv->infCalendar()));
18061804
QuantLib::ext::shared_ptr<InflationCouponPricer> yoyCpnPricer =
18071805
QuantLib::ext::make_shared<YoYInflationCouponPricer>(discountCurve);
18081806
for (auto& c : helper->yoyLeg()) {
@@ -1879,12 +1877,11 @@ void ParSensitivityInstrumentBuilder::makeYoYCapFloor(ParSensitivityInstrumentBu
18791877
}
18801878

18811879
// build the leg data and instrument
1882-
QL_DEPRECATED_DISABLE_WARNING
1883-
Leg yoyLeg = yoyInflationLeg(yoySchedule, yoySchedule.calendar(), index, conv->observationLag())
1884-
.withNotionals(1.0)
1885-
.withPaymentDayCounter(conv->dayCounter())
1886-
.withRateCurve(discountCurve);
1887-
QL_DEPRECATED_ENABLE_WARNING
1880+
Leg yoyLeg =
1881+
yoyInflationLeg(yoySchedule, yoySchedule.calendar(), index, conv->observationLag(), QuantLib::CPI::AsIndex)
1882+
.withNotionals(1.0)
1883+
.withPaymentDayCounter(conv->dayCounter())
1884+
.withRateCurve(discountCurve);
18881885
if (market == nullptr)
18891886
return;
18901887

OREAnalytics/orea/engine/saccrcalculator.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ void SaccrCalculator::aggregate() {
270270
DLOG("SA-CCR: Hedging set AddOn calculation");
271271
for (map<HedgingSetKey, Real>::iterator it = addOnHedgingSet_.begin(); it != addOnHedgingSet_.end(); it++) {
272272
// Add-ons
273-
const NettingSetDetails& nettingSetDetails = QuantLib::ext::get<0>(it->first);
274-
const AssetClass& assetClass = QuantLib::ext::get<1>(it->first);
275-
const string& hedgingSet = QuantLib::ext::get<2>(it->first);
273+
const NettingSetDetails& nettingSetDetails = std::get<0>(it->first);
274+
const AssetClass& assetClass = std::get<1>(it->first);
275+
const string& hedgingSet = std::get<2>(it->first);
276276
if (assetClass == AssetClass::IR) {
277277
// effectiveNotional_[it->first] =
278278
// sqrt(D1 * D1 + D2 * D2 + D3 * D3 + 1.4 * (D1 * D2 + D2 * D3) + 0.6 * D1 * D3);
@@ -290,12 +290,12 @@ void SaccrCalculator::aggregate() {
290290
Real addonType = 0;
291291
Real addonTypeSquared = 0;
292292
for (const auto& [hedgingSubsetKey, effectiveNotional] : subsetEffectiveNotional_) {
293-
HedgingSetKey hedgingSetKey(QuantLib::ext::get<0>(hedgingSubsetKey),
294-
QuantLib::ext::get<1>(hedgingSubsetKey),
295-
QuantLib::ext::get<2>(hedgingSubsetKey));
293+
HedgingSetKey hedgingSetKey(std::get<0>(hedgingSubsetKey),
294+
std::get<1>(hedgingSubsetKey),
295+
std::get<2>(hedgingSubsetKey));
296296
if (hedgingSetKey != it->first)
297297
continue;
298-
const string& hedgingSubset = QuantLib::ext::get<3>(hedgingSubsetKey);
298+
const string& hedgingSubset = std::get<3>(hedgingSubsetKey);
299299
vector<string> tokens;
300300
boost::split(tokens, hedgingSubset, boost::is_any_of("_"));
301301
QL_REQUIRE(tokens.size() == 1 || tokens.size() == 2,
@@ -319,10 +319,10 @@ void SaccrCalculator::aggregate() {
319319
Real addonType = 0;
320320
Real addonTypeSquared = 0;
321321
for (const auto& [hedgingSubsetKey, effectiveNotional] : subsetEffectiveNotional_) {
322-
string hedgingSubset = QuantLib::ext::get<3>(hedgingSubsetKey);
323-
HedgingSetKey hedgingSetKey(QuantLib::ext::get<0>(hedgingSubsetKey),
324-
QuantLib::ext::get<1>(hedgingSubsetKey),
325-
QuantLib::ext::get<2>(hedgingSubsetKey));
322+
string hedgingSubset = std::get<3>(hedgingSubsetKey);
323+
HedgingSetKey hedgingSetKey(std::get<0>(hedgingSubsetKey),
324+
std::get<1>(hedgingSubsetKey),
325+
std::get<2>(hedgingSubsetKey));
326326
if (hedgingSetKey != it->first)
327327
continue;
328328
bool isEquityIndex = isIndex_[hedgingSubset];
@@ -352,9 +352,9 @@ void SaccrCalculator::aggregate() {
352352
DLOG("SA-CCR: Asset Class AddOn calculation");
353353
for (map<AssetClassKey, Real>::iterator it = addOnAssetClass_.begin(); it != addOnAssetClass_.end(); it++) {
354354
for (map<HedgingSetKey, Real>::iterator ith = addOnHedgingSet_.begin(); ith != addOnHedgingSet_.end(); ith++) {
355-
NettingSetDetails nettingSetDetails = QuantLib::ext::get<0>(ith->first);
356-
AssetClass assetClass = QuantLib::ext::get<1>(ith->first);
357-
// string hedgingSet = QuantLib::ext::get<2>(it->first);
355+
NettingSetDetails nettingSetDetails = std::get<0>(ith->first);
356+
AssetClass assetClass = std::get<1>(ith->first);
357+
// string hedgingSet = std::get<2>(it->first);
358358
AssetClassKey key(nettingSetDetails, assetClass);
359359
if (it->first != key)
360360
continue;
@@ -421,12 +421,12 @@ void SaccrCalculator::aggregate() {
421421

422422
hedgingSets_.clear();
423423
for (map<HedgingSetKey, Real>::iterator it = addOnHedgingSet_.begin(); it != addOnHedgingSet_.end(); it++) {
424-
NettingSetDetails nettingSetDetails = QuantLib::ext::get<0>(it->first);
425-
AssetClass ac = QuantLib::ext::get<1>(it->first);
424+
NettingSetDetails nettingSetDetails = std::get<0>(it->first);
425+
AssetClass ac = std::get<1>(it->first);
426426
pair<NettingSetDetails, AssetClass> key(nettingSetDetails, ac);
427427
if (hedgingSets_.find(key) == hedgingSets_.end())
428428
hedgingSets_[key] = vector<string>();
429-
hedgingSets_[key].push_back(QuantLib::ext::get<2>(it->first));
429+
hedgingSets_[key].push_back(std::get<2>(it->first));
430430
}
431431

432432
if (reports_.size() > 0)

OREAnalytics/orea/engine/smrc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <utility> // pair
2727
#include <vector>
2828

29-
#include <ql/tuple.hpp>
29+
#include <tuple>
3030
#include <boost/tuple/tuple_comparison.hpp>
3131

3232
#include <ql/time/period.hpp>

OREAnalytics/orea/engine/standardapproachcvacalculator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <ored/utilities/log.hpp>
2323
#include <ql/errors.hpp>
2424
#include <ql/math/comparison.hpp>
25-
#include <ql/tuple.hpp>
25+
#include <tuple>
2626
#include <boost/math/distributions/normal.hpp>
2727
#include <ored/utilities/parsers.hpp>
2828
#include <ored/utilities/to_string.hpp>
@@ -244,9 +244,9 @@ QuantLib::Real StandardApproachCvaCalculator::getHedgeSensi(const CvaRiskFactorK
244244
return 0.0;
245245
} else {
246246
auto& indexRiskFactor = cvaNetSensitivities_.get<CvaRiskFactorTag>();
247-
if (indexRiskFactor.count(QuantLib::ext::make_tuple("", rt, b, mt, rf, CvaType::CvaHedge)) == 0)
247+
if (indexRiskFactor.count(std::make_tuple("", rt, b, mt, rf, CvaType::CvaHedge)) == 0)
248248
QL_FAIL("no hedge sensitivity found for " << rt << " " << b << " " << mt << " " << rf << " ");
249-
auto it = indexRiskFactor.find(QuantLib::ext::make_tuple("", rt, b, mt, rf, CvaType::CvaHedge));
249+
auto it = indexRiskFactor.find(std::make_tuple("", rt, b, mt, rf, CvaType::CvaHedge));
250250
return it->value;
251251
}
252252
}
@@ -272,7 +272,7 @@ void StandardApproachCvaCalculator::calculate() {
272272
for (auto mt : marginTypes) {
273273
set<std::string> buckets;
274274
set<std::string> riskFactors;
275-
auto p = indexRiskType.equal_range(QuantLib::ext::make_tuple(n, rt, mt));
275+
auto p = indexRiskType.equal_range(std::make_tuple(n, rt, mt));
276276
while (p.first != p.second) {
277277
buckets.insert(p.first->bucket);
278278
checkRiskFactor(rt, mt, p.first->riskFactor);
@@ -285,8 +285,8 @@ void StandardApproachCvaCalculator::calculate() {
285285
map<string, Real> ws;
286286
vector<Real> ws_hdg;
287287
for (auto rf : riskFactors) {
288-
if (indexRiskFactor.count(QuantLib::ext::make_tuple(n, rt, b, mt, rf, CvaType::CvaAggregate)) != 0) {
289-
auto it = indexRiskFactor.find(QuantLib::ext::make_tuple(n, rt, b, mt, rf, CvaType::CvaAggregate));
288+
if (indexRiskFactor.count(std::make_tuple(n, rt, b, mt, rf, CvaType::CvaAggregate)) != 0) {
289+
auto it = indexRiskFactor.find(std::make_tuple(n, rt, b, mt, rf, CvaType::CvaAggregate));
290290
Real sk_cva = it->value;
291291
Real sk_hdg = getHedgeSensi(rt, b, mt, rf, sk_cva);
292292
Real rw = getRiskWeight(rt, b, mt, rf);

OREAnalytics/orea/simm/crifgenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#include <boost/algorithm/string.hpp>
4040

41-
#include <ql/tuple.hpp>
41+
#include <tuple>
4242
#include <ql/errors.hpp>
4343

4444
#include <iomanip>
@@ -97,7 +97,7 @@ CrifGenerator::generateCrif(const QuantLib::ext::shared_ptr<ore::analytics::Sens
9797
auto results = QuantLib::ext::make_shared<Crif>();
9898

9999
// A map that will be used to store Risk_FX sensitivities for the (base) currency itself for each trade.
100-
map<QuantLib::ext::tuple<string, string, string>, CrifRecord> riskFxCalcCurrency;
100+
map<std::tuple<string, string, string>, CrifRecord> riskFxCalcCurrency;
101101

102102
set<string> failedTrades;
103103

OREAnalytics/orea/simm/crifrecordgenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include <qle/utilities/inflation.hpp>
3838

3939
#include <boost/algorithm/string.hpp>
40-
#include <ql/tuple.hpp>
40+
#include <tuple>
4141

4242
#include <iomanip>
4343
#include <map>

OREAnalytics/test/testmarket.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ Handle<ZeroInflationIndex> TestMarket::makeZeroInflationIndex(string index, vect
568568
for (Size i = 0; i < dates.size(); i++) {
569569
Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(rates[i] / 100.0)));
570570
QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>> anInstrument(
571-
new ZeroCouponInflationSwapHelper(quote, Period(2, Months), dates[i], TARGET(), ModifiedFollowing,
572-
ActualActual(ActualActual::ISDA), ii, CPI::AsIndex, yts, asof_));
571+
new ZeroCouponInflationSwapHelper(quote, Period(2, Months), asof_, dates[i], TARGET(), ModifiedFollowing,
572+
ActualActual(ActualActual::ISDA), ii, CPI::AsIndex));
573573

574574
// Remove the helper's observation of the inflation index. This has the effect that the
575575
// PiecewiseZeroInflationCurve created below will also not observe the index. It will only get recalculated
@@ -605,11 +605,9 @@ Handle<YoYInflationIndex> TestMarket::makeYoYInflationIndex(string index, vector
605605
vector<QuantLib::ext::shared_ptr<BootstrapHelper<YoYInflationTermStructure>>> instruments;
606606
for (Size i = 0; i < dates.size(); i++) {
607607
Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(rates[i] / 100.0)));
608-
QL_DEPRECATED_DISABLE_WARNING
609608
QuantLib::ext::shared_ptr<BootstrapHelper<YoYInflationTermStructure>> anInstrument(
610-
new YearOnYearInflationSwapHelper(quote, Period(2, Months), dates[i], TARGET(), ModifiedFollowing,
611-
ActualActual(ActualActual::ISDA), ii, yts, asof_));
612-
QL_DEPRECATED_ENABLE_WARNING
609+
new YearOnYearInflationSwapHelper(quote, Period(2, Months), asof_, dates[i], TARGET(), ModifiedFollowing,
610+
ActualActual(ActualActual::ISDA), ii, CPI::AsIndex, yts));
613611

614612
// Remove the helper's observation of the inflation index. This has the effect that the
615613
// PiecewiseYoYInflationCurve created below will also not observe the index. It will only get recalculated
@@ -1175,8 +1173,8 @@ void TestMarketParCurves::createYoYInflationIndex(const string& idxName, const v
11751173
std::vector<QuantLib::ext::shared_ptr<YoYInflationTraits::helper>> instruments;
11761174
for (Size i = 0; i < parTenor.size(); i++) {
11771175
instruments.push_back(QuantLib::ext::make_shared<YearOnYearInflationSwapHelper>(
1178-
parQuotes[i], conv->observationLag(), asof_ + parTenor[i], conv->infCalendar(), conv->infConvention(),
1179-
conv->dayCounter(), yi, yieldCurve(YieldCurveType::Discount, ccy, Market::defaultConfiguration)));
1176+
parQuotes[i], conv->observationLag(), asof_, asof_ + parTenor[i], conv->infCalendar(), conv->infConvention(),
1177+
conv->dayCounter(), yi, CPI::AsIndex, yieldCurve(YieldCurveType::Discount, ccy, Market::defaultConfiguration)));
11801178
}
11811179
QuantLib::ext::shared_ptr<YoYInflationTermStructure> yoyCurve;
11821180

OREData/ored/marketdata/dependencygraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <ored/utilities/log.hpp>
2929
#include <ored/utilities/parsers.hpp>
3030
#include <ored/utilities/to_string.hpp>
31-
#include <ql/tuple.hpp>
31+
#include <tuple>
3232

3333
namespace ore {
3434
namespace data {

OREData/ored/marketdata/inflationcapfloorvolcurve.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ void InflationCapFloorVolCurve::buildFromVolatilities(
252252

253253
YoYPriceSurfaceFromVolatilities volToPriceConverter;
254254

255-
auto priceSurface = volToPriceConverter(capVol, index, discountCurve_, quoteVolatilityType, 0.0);
255+
auto priceSurface = volToPriceConverter(capVol, index, index->interpolated() ? CPI::Linear : CPI::Flat,
256+
discountCurve_, quoteVolatilityType, 0.0);
256257

257258
// Get configuration values for bootstrap
258259
Real accuracy = config->bootstrapConfig().accuracy();
@@ -564,16 +565,14 @@ void InflationCapFloorVolCurve::buildFromPrices(Date asof, InflationCapFloorVola
564565
true, Handle<YoYInflationTermStructure>());
565566
}
566567
}
567-
// Required by the QL pricesurface but not used
568-
Rate startRate = 0.0;
569568
// Build the term structure
570-
QL_DEPRECATED_DISABLE_WARNING
569+
571570
QuantLib::ext::shared_ptr<QuantExt::InterpolatedYoYCapFloorTermPriceSurface<QuantLib::Bilinear, QuantLib::Linear>>
572571
yoySurface = QuantLib::ext::make_shared<
573572
QuantExt::InterpolatedYoYCapFloorTermPriceSurface<QuantLib::Bilinear, QuantLib::Linear>>(
574-
0, config->observationLag(), index, startRate, discountCurve_, config->dayCounter(), config->calendar(),
573+
0, config->observationLag(), index, CPI::AsIndex, discountCurve_, config->dayCounter(), config->calendar(),
575574
config->businessDayConvention(), capStrikes, floorStrikes, terms, cPrice, fPrice);
576-
QL_DEPRECATED_ENABLE_WARNING
575+
577576
std::vector<Period> optionletTerms = {yoySurface->maturities().front()};
578577
while (optionletTerms.back() != terms.back()) {
579578
optionletTerms.push_back(optionletTerms.back() + Period(1, Years));

0 commit comments

Comments
 (0)