Skip to content

Commit 3d975ba

Browse files
committed
Merge branch 'feature/QPR-13777' into 'master'
QPR-13777 update to QL 1.41 Closes QPR-13777 See merge request qs/oreplus!3166
2 parents 3abe937 + 5fd6b49 commit 3d975ba

54 files changed

Lines changed: 155 additions & 166 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/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/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/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
};

0 commit comments

Comments
 (0)