Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconfigurationisdav2_3_8.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 Quaternion Risk Management Ltd.
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
21#include <ql/math/matrix.hpp>
22
23#include <boost/algorithm/string/predicate.hpp>
24#include <boost/make_shared.hpp>
25
26using QuantLib::InterestRateIndex;
27using QuantLib::Matrix;
28using QuantLib::Real;
29using std::string;
30using std::vector;
31
32namespace ore {
33namespace analytics {
34
35QuantLib::Size SimmConfiguration_ISDA_V2_3_8::group(const string& qualifier, const std::map<QuantLib::Size,
36 std::set<string>>& categories) const {
37 QuantLib::Size result = 0;
38 for (const auto& kv : categories) {
39 if (kv.second.empty()) {
40 result = kv.first;
41 } else {
42 if (kv.second.count(qualifier) > 0) {
43 // Found qualifier in category so return it
44 return kv.first;
45 }
46 }
47 }
48
49 // If we get here, result should hold category with empty set
50 return result;
51}
52
53QuantLib::Real SimmConfiguration_ISDA_V2_3_8::weight(const CrifRecord::RiskType& rt, boost::optional<string> qualifier,
54 boost::optional<std::string> label_1,
55 const std::string& calculationCurrency) const {
56
57 if (rt == CrifRecord::RiskType::FX) {
58 QL_REQUIRE(calculationCurrency != "", "no calculation currency provided weight");
59 QL_REQUIRE(qualifier, "need a qualifier to return a risk weight for the risk type FX");
60
61 QuantLib::Size g1 = group(calculationCurrency, ccyGroups_);
62 QuantLib::Size g2 = group(*qualifier, ccyGroups_);
63 return rwFX_[g1][g2];
64 }
65
66 return SimmConfigurationBase::weight(rt, qualifier, label_1);
67}
68
69QuantLib::Real SimmConfiguration_ISDA_V2_3_8::correlation(const CrifRecord::RiskType& firstRt, const string& firstQualifier,
70 const string& firstLabel_1, const string& firstLabel_2,
71 const CrifRecord::RiskType& secondRt, const string& secondQualifier,
72 const string& secondLabel_1, const string& secondLabel_2,
73 const std::string& calculationCurrency) const {
74
75 if (firstRt == CrifRecord::RiskType::FX && secondRt == CrifRecord::RiskType::FX) {
76 QL_REQUIRE(calculationCurrency != "", "no calculation currency provided corr");
77 QuantLib::Size g = group(calculationCurrency, ccyGroups_);
78 QuantLib::Size g1 = group(firstQualifier, ccyGroups_);
79 QuantLib::Size g2 = group(secondQualifier, ccyGroups_);
80 if (g == 0) {
81 return fxRegVolCorrelation_[g1][g2];
82 } else if (g == 1) {
83 return fxHighVolCorrelation_[g1][g2];
84 } else {
85 QL_FAIL("FX Volatility group " << g << " not recognized");
86 }
87 }
88
89 return SimmConfigurationBase::correlation(firstRt, firstQualifier, firstLabel_1, firstLabel_2, secondRt,
90 secondQualifier, secondLabel_1, secondLabel_2);
91}
92
93SimmConfiguration_ISDA_V2_3_8::SimmConfiguration_ISDA_V2_3_8(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper,
94 const QuantLib::Size& mporDays, const std::string& name,
95 const std::string version)
96 : SimmConfigurationBase(simmBucketMapper, name, version, mporDays) {
97
98 // The differences in methodology for 1 Day horizon is described in
99 // Standard Initial Margin Model: Technical Paper, ISDA SIMM Governance Forum, Version 10:
100 // Section I - Calibration with one-day horizon
101 QL_REQUIRE(mporDays_ == 10 || mporDays_ == 1, "SIMM only supports MPOR 10-day or 1-day");
102
103 // Set up the correct concentration threshold getter
104 if (mporDays == 10) {
105 simmConcentration_ = QuantLib::ext::make_shared<SimmConcentration_ISDA_V2_3_8>(simmBucketMapper_);
106 } else {
107 // SIMM:Technical Paper, Section I.4: "The Concentration Risk feature is disabled"
108 simmConcentration_ = QuantLib::ext::make_shared<SimmConcentrationBase>();
109 }
110
111 // clang-format off
112
113 // Set up the members for this configuration
114 // Explanations of all these members are given in the hpp file
115
116 mapBuckets_ = {
117 { CrifRecord::RiskType::IRCurve, { "1", "2", "3" } },
118 { CrifRecord::RiskType::CreditQ, { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "Residual" } },
119 { CrifRecord::RiskType::CreditVol, { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "Residual" } },
120 { CrifRecord::RiskType::CreditNonQ, { "1", "2", "Residual" } },
121 { CrifRecord::RiskType::CreditVolNonQ, { "1", "2", "Residual" } },
122 { CrifRecord::RiskType::Equity, { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "Residual" } },
123 { CrifRecord::RiskType::EquityVol, { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "Residual" } },
124 { CrifRecord::RiskType::Commodity, { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17" } },
125 { CrifRecord::RiskType::CommodityVol, { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17" } }
126 };
127
128 mapLabels_1_ = {
129 { CrifRecord::RiskType::IRCurve, { "2w", "1m", "3m", "6m", "1y", "2y", "3y", "5y", "10y", "15y", "20y", "30y" } },
130 { CrifRecord::RiskType::CreditQ, { "1y", "2y", "3y", "5y", "10y" } },
131 { CrifRecord::RiskType::CreditNonQ, { "1y", "2y", "3y", "5y", "10y" } },
132 { CrifRecord::RiskType::IRVol, { "2w", "1m", "3m", "6m", "1y", "2y", "3y", "5y", "10y", "15y", "20y", "30y" } },
133 { CrifRecord::RiskType::InflationVol, { "2w", "1m", "3m", "6m", "1y", "2y", "3y", "5y", "10y", "15y", "20y", "30y" } },
134 { CrifRecord::RiskType::CreditVol, { "1y", "2y", "3y", "5y", "10y" } },
135 { CrifRecord::RiskType::CreditVolNonQ, { "1y", "2y", "3y", "5y", "10y" } },
136 { CrifRecord::RiskType::EquityVol, { "2w", "1m", "3m", "6m", "1y", "2y", "3y", "5y", "10y", "15y", "20y", "30y" } },
137 { CrifRecord::RiskType::CommodityVol, { "2w", "1m", "3m", "6m", "1y", "2y", "3y", "5y", "10y", "15y", "20y", "30y" } },
138 { CrifRecord::RiskType::FXVol, { "2w", "1m", "3m", "6m", "1y", "2y", "3y", "5y", "10y", "15y", "20y", "30y" } }
139 };
140
141 mapLabels_2_ = {
142 { CrifRecord::RiskType::IRCurve, { "OIS", "Libor1m", "Libor3m", "Libor6m", "Libor12m", "Prime", "Municipal" } },
143 { CrifRecord::RiskType::CreditQ, { "", "Sec" } }
144 };
145
146 // Populate CCY groups that are used for FX correlations and risk weights
147 // The groups consists of High Vol Currencies (ARS, BRL, MXN, TRY, ZAR) & regular vol currencies (all others)
148 ccyGroups_ = {
149 { 1, { "ARS", "BRL", "MXN", "TRY", "ZAR" } },
150 { 0, { } },
151 };
152
153 vector<Real> temp;
154
155 if (mporDays_ == 10) {
156 // Risk weights
157 temp = {
158 7.3, 13.0,
159 13.0, 10.2
160 };
161 rwFX_ = Matrix(2, 2, temp.begin(), temp.end());
162
163 rwRiskType_ = {
164 { CrifRecord::RiskType::Inflation, 64 },
165 { CrifRecord::RiskType::XCcyBasis, 21 },
166 { CrifRecord::RiskType::IRVol, 0.18 },
167 { CrifRecord::RiskType::InflationVol, 0.18 },
168 { CrifRecord::RiskType::CreditVol, 0.73 },
169 { CrifRecord::RiskType::CreditVolNonQ, 0.73 },
170 { CrifRecord::RiskType::CommodityVol, 0.61 },
171 { CrifRecord::RiskType::FXVol, 0.47 },
172 { CrifRecord::RiskType::BaseCorr, 11.0 }
173 };
174
175 rwBucket_ = {
176 {CrifRecord::RiskType::CreditQ,
177 {{{"1", "", ""}, 81.0},
178 {{"2", "", ""}, 96.0},
179 {{"3", "", ""}, 86.0},
180 {{"4", "", ""}, 53.0},
181 {{"5", "", ""}, 59.0},
182 {{"6", "", ""}, 47.0},
183 {{"7", "", ""}, 181.0},
184 {{"8", "", ""}, 452.0},
185 {{"9", "", ""}, 252.0},
186 {{"10", "", ""}, 261.0},
187 {{"11", "", ""}, 218.0},
188 {{"12", "", ""}, 195.0},
189 {{"Residual", "", ""}, 452.0}}},
190 {CrifRecord::RiskType::CreditNonQ,
191 {{{"1", "", ""}, 280.0},
192 {{"2", "", ""}, 1200.0},
193 {{"Residual", "", ""}, 1200.0}}},
194 {CrifRecord::RiskType::Equity,
195 {{{"1", "", ""}, 25.0},
196 {{"2", "", ""}, 28.0},
197 {{"3", "", ""}, 30.0},
198 {{"4", "", ""}, 28.0},
199 {{"5", "", ""}, 23.0},
200 {{"6", "", ""}, 24.0},
201 {{"7", "", ""}, 29.0},
202 {{"8", "", ""}, 27.0},
203 {{"9", "", ""}, 31.0},
204 {{"10", "", ""}, 33.0},
205 {{"11", "", ""}, 19.0},
206 {{"12", "", ""}, 19.0},
207 {{"Residual", "", ""}, 33.0}}},
208 {CrifRecord::RiskType::Commodity,
209 {{{"1", "", ""}, 22.0},
210 {{"2", "", ""}, 29.0},
211 {{"3", "", ""}, 33.0},
212 {{"4", "", ""}, 25.0},
213 {{"5", "", ""}, 35.0},
214 {{"6", "", ""}, 24.0},
215 {{"7", "", ""}, 22.0},
216 {{"8", "", ""}, 49.0},
217 {{"9", "", ""}, 24.0},
218 {{"10", "", ""}, 53.0},
219 {{"11", "", ""}, 20.0},
220 {{"12", "", ""}, 21.0},
221 {{"13", "", ""}, 13.0},
222 {{"14", "", ""}, 15.0},
223 {{"15", "", ""}, 13.0},
224 {{"16", "", ""}, 53.0},
225 {{"17", "", ""}, 17.0}}},
226 {CrifRecord::RiskType::EquityVol,
227 {{{"1", "", ""}, 0.50},
228 {{"2", "", ""}, 0.50},
229 {{"3", "", ""}, 0.50},
230 {{"4", "", ""}, 0.50},
231 {{"5", "", ""}, 0.50},
232 {{"6", "", ""}, 0.50},
233 {{"7", "", ""}, 0.50},
234 {{"8", "", ""}, 0.50},
235 {{"9", "", ""}, 0.50},
236 {{"10", "", ""}, 0.50},
237 {{"11", "", ""}, 0.50},
238 {{"12", "", ""}, 0.98},
239 {{"Residual", "", ""}, 0.50}}},
240 };
241
242 rwLabel_1_ = {
243 {CrifRecord::RiskType::IRCurve,
244 {{{"1", "2w", ""}, 114.0},
245 {{"1", "1m", ""}, 106.0},
246 {{"1", "3m", ""}, 95.0},
247 {{"1", "6m", ""}, 74.0},
248 {{"1", "1y", ""}, 66.0},
249 {{"1", "2y", ""}, 61.0},
250 {{"1", "3y", ""}, 56.0},
251 {{"1", "5y", ""}, 52.0},
252 {{"1", "10y", ""}, 53.0},
253 {{"1", "15y", ""}, 57.0},
254 {{"1", "20y", ""}, 60.0},
255 {{"1", "30y", ""}, 66.0},
256 {{"2", "2w", ""}, 15.0},
257 {{"2", "1m", ""}, 18.0},
258 {{"2", "3m", ""}, 8.6},
259 {{"2", "6m", ""}, 11.0},
260 {{"2", "1y", ""}, 13.0},
261 {{"2", "2y", ""}, 15.0},
262 {{"2", "3y", ""}, 18.0},
263 {{"2", "5y", ""}, 20.0},
264 {{"2", "10y", ""}, 19.0},
265 {{"2", "15y", ""}, 19.0},
266 {{"2", "20y", ""}, 20.0},
267 {{"2", "30y", ""}, 23.0},
268 {{"3", "2w", ""}, 101.0},
269 {{"3", "1m", ""}, 91.0},
270 {{"3", "3m", ""}, 78.0},
271 {{"3", "6m", ""}, 80.0},
272 {{"3", "1y", ""}, 90.0},
273 {{"3", "2y", ""}, 89.0},
274 {{"3", "3y", ""}, 94.0},
275 {{"3", "5y", ""}, 94.0},
276 {{"3", "10y", ""}, 92.0},
277 {{"3", "15y", ""}, 101.0},
278 {{"3", "20y", ""}, 104.0},
279 {{"3", "30y", ""}, 102.0}}
280 }
281 };
282
283 // Historical volatility ratios
284 historicalVolatilityRatios_[CrifRecord::RiskType::EquityVol] = 0.54;
285 historicalVolatilityRatios_[CrifRecord::RiskType::CommodityVol] = 0.64;
286 historicalVolatilityRatios_[CrifRecord::RiskType::FXVol] = 0.55;
287 hvr_ir_ = 0.44;
288 // Curvature weights
290 { CrifRecord::RiskType::IRVol, { 0.5,
291 0.5 * 14.0 / (365.0 / 12.0),
292 0.5 * 14.0 / (3.0 * 365.0 / 12.0),
293 0.5 * 14.0 / (6.0 * 365.0 / 12.0),
294 0.5 * 14.0 / 365.0,
295 0.5 * 14.0 / (2.0 * 365.0),
296 0.5 * 14.0 / (3.0 * 365.0),
297 0.5 * 14.0 / (5.0 * 365.0),
298 0.5 * 14.0 / (10.0 * 365.0),
299 0.5 * 14.0 / (15.0 * 365.0),
300 0.5 * 14.0 / (20.0 * 365.0),
301 0.5 * 14.0 / (30.0 * 365.0) }
302 },
303 { CrifRecord::RiskType::CreditVol, { 0.5 * 14.0 / 365.0,
304 0.5 * 14.0 / (2.0 * 365.0),
305 0.5 * 14.0 / (3.0 * 365.0),
306 0.5 * 14.0 / (5.0 * 365.0),
307 0.5 * 14.0 / (10.0 * 365.0) }
308 }
309 };
310 curvatureWeights_[CrifRecord::RiskType::InflationVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
311 curvatureWeights_[CrifRecord::RiskType::EquityVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
312 curvatureWeights_[CrifRecord::RiskType::CommodityVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
313 curvatureWeights_[CrifRecord::RiskType::FXVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
314 curvatureWeights_[CrifRecord::RiskType::CreditVolNonQ] = curvatureWeights_[CrifRecord::RiskType::CreditVol];
315
316 } else {
317 // SIMM:Technical Paper, Section I.1: "All delta and vega risk weights should be replaced with the values for
318 // one-day calibration given in the Calibration Results document."
319
320 // Risk weights
321 temp = {
322 1.8, 3.0,
323 3.0, 2.9
324 };
325 rwFX_ = Matrix(2, 2, temp.begin(), temp.end());
326
327 rwRiskType_ = {
328 { CrifRecord::RiskType::Inflation, 15 },
329 { CrifRecord::RiskType::XCcyBasis, 5.6 },
330 { CrifRecord::RiskType::IRVol, 0.046 },
331 { CrifRecord::RiskType::InflationVol, 0.046 },
332 { CrifRecord::RiskType::CreditVol, 0.1 },
333 { CrifRecord::RiskType::CreditVolNonQ, 0.1 },
334 { CrifRecord::RiskType::CommodityVol, 0.13 },
335 { CrifRecord::RiskType::FXVol, 0.099 },
336 { CrifRecord::RiskType::BaseCorr, 2.7 }
337 };
338
339 rwBucket_ = {
340 {CrifRecord::RiskType::CreditQ,
341 {{{"1", "", ""}, 23.0},
342 {{"2", "", ""}, 27.0},
343 {{"3", "", ""}, 18.0},
344 {{"4", "", ""}, 12.0},
345 {{"5", "", ""}, 13.0},
346 {{"6", "", ""}, 12.0},
347 {{"7", "", ""}, 49.0},
348 {{"8", "", ""}, 92.0},
349 {{"9", "", ""}, 48.0},
350 {{"10", "", ""}, 59.0},
351 {{"11", "", ""}, 41.0},
352 {{"12", "", ""}, 41.0},
353 {{"Residual", "", ""}, 92.0}}},
354 {CrifRecord::RiskType::CreditNonQ, {{{"1", "", ""}, 74.0}, {{"2", "", ""}, 240.0}, {{"Residual", "", ""}, 240.0}}},
355 {CrifRecord::RiskType::Equity,
356 {{{"1", "", ""}, 8.3},
357 {{"2", "", ""}, 9.1},
358 {{"3", "", ""}, 9.8},
359 {{"4", "", ""}, 9.0},
360 {{"5", "", ""}, 7.7},
361 {{"6", "", ""}, 8.4},
362 {{"7", "", ""}, 9.3},
363 {{"8", "", ""}, 9.4},
364 {{"9", "", ""}, 9.9},
365 {{"10", "", ""}, 11.0},
366 {{"11", "", ""}, 6.0},
367 {{"12", "", ""}, 6.0},
368 {{"Residual", "", ""}, 11.0}}},
369 {CrifRecord::RiskType::Commodity,
370 {{{"1", "", ""}, 6.3},
371 {{"2", "", ""}, 9.1},
372 {{"3", "", ""}, 8.1},
373 {{"4", "", ""}, 7.2},
374 {{"5", "", ""}, 10.0},
375 {{"6", "", ""}, 8.0},
376 {{"7", "", ""}, 7.1},
377 {{"8", "", ""}, 11.0},
378 {{"9", "", ""}, 8.1},
379 {{"10", "", ""}, 16.0},
380 {{"11", "", ""}, 6.2},
381 {{"12", "", ""}, 6.2},
382 {{"13", "", ""}, 4.7},
383 {{"14", "", ""}, 4.8},
384 {{"15", "", ""}, 3.8},
385 {{"16", "", ""}, 16.0},
386 {{"17", "", ""}, 5.1}}},
387 {CrifRecord::RiskType::EquityVol,
388 {{{"1", "", ""}, 0.094},
389 {{"2", "", ""}, 0.094},
390 {{"3", "", ""}, 0.094},
391 {{"4", "", ""}, 0.094},
392 {{"5", "", ""}, 0.094},
393 {{"6", "", ""}, 0.094},
394 {{"7", "", ""}, 0.094},
395 {{"8", "", ""}, 0.094},
396 {{"9", "", ""}, 0.094},
397 {{"10", "", ""}, 0.094},
398 {{"11", "", ""}, 0.094},
399 {{"12", "", ""}, 0.27},
400 {{"Residual", "", ""}, 0.094}}},
401 };
402
403 rwLabel_1_ = {
404 {CrifRecord::RiskType::IRCurve,
405 {{{"1", "2w", ""}, 18.0},
406 {{"1", "1m", ""}, 15.0},
407 {{"1", "3m", ""}, 12.0},
408 {{"1", "6m", ""}, 12.0},
409 {{"1", "1y", ""}, 13.0},
410 {{"1", "2y", ""}, 15.0},
411 {{"1", "3y", ""}, 16.0},
412 {{"1", "5y", ""}, 16.0},
413 {{"1", "10y", ""}, 16.0},
414 {{"1", "15y", ""}, 17.0},
415 {{"1", "20y", ""}, 16.0},
416 {{"1", "30y", ""}, 17.0},
417 {{"2", "2w", ""}, 1.7},
418 {{"2", "1m", ""}, 3.4},
419 {{"2", "3m", ""}, 1.6},
420 {{"2", "6m", ""}, 2.0},
421 {{"2", "1y", ""}, 3.0},
422 {{"2", "2y", ""}, 4.8},
423 {{"2", "3y", ""}, 5.8},
424 {{"2", "5y", ""}, 6.8},
425 {{"2", "10y", ""}, 6.5},
426 {{"2", "15y", ""}, 7.0},
427 {{"2", "20y", ""}, 7.5},
428 {{"2", "30y", ""}, 8.3},
429 {{"3", "2w", ""}, 36.0},
430 {{"3", "1m", ""}, 27.0},
431 {{"3", "3m", ""}, 16.0},
432 {{"3", "6m", ""}, 19.0},
433 {{"3", "1y", ""}, 23.0},
434 {{"3", "2y", ""}, 23.0},
435 {{"3", "3y", ""}, 32.0},
436 {{"3", "5y", ""}, 31.0},
437 {{"3", "10y", ""}, 32.0},
438 {{"3", "15y", ""}, 30.0},
439 {{"3", "20y", ""}, 32.0},
440 {{"3", "30y", ""}, 27.0}}
441 }
442 };
443
444 // Historical volatility ratios
445 historicalVolatilityRatios_[CrifRecord::RiskType::EquityVol] = 0.5;
446 historicalVolatilityRatios_[CrifRecord::RiskType::CommodityVol] = 0.67;
447 historicalVolatilityRatios_[CrifRecord::RiskType::FXVol] = 0.73;
448 hvr_ir_ = 0.5;
449
450 // Curvature weights
451 //SIMM:Technical Paper, Section I.3, this 10-day formula for curvature weights is modified
453 { CrifRecord::RiskType::IRVol, { 0.5 / 10.0,
454 0.5 * 1.40 / (365.0 / 12.0),
455 0.5 * 1.40 / (3.0 * 365.0 / 12.0),
456 0.5 * 1.40 / (6.0 * 365.0 / 12.0),
457 0.5 * 1.40 / 365.0,
458 0.5 * 1.40 / (2.0 * 365.0),
459 0.5 * 1.40 / (3.0 * 365.0),
460 0.5 * 1.40 / (5.0 * 365.0),
461 0.5 * 1.40 / (10.0 * 365.0),
462 0.5 * 1.40 / (15.0 * 365.0),
463 0.5 * 1.40 / (20.0 * 365.0),
464 0.5 * 1.40 / (30.0 * 365.0) }
465 },
466 { CrifRecord::RiskType::CreditVol, { 0.5 * 1.40 / 365.0,
467 0.5 * 1.40 / (2.0 * 365.0),
468 0.5 * 1.40 / (3.0 * 365.0),
469 0.5 * 1.40 / (5.0 * 365.0),
470 0.5 * 1.40 / (10.0 * 365.0) }
471 }
472 };
473 curvatureWeights_[CrifRecord::RiskType::InflationVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
474 curvatureWeights_[CrifRecord::RiskType::EquityVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
475 curvatureWeights_[CrifRecord::RiskType::CommodityVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
476 curvatureWeights_[CrifRecord::RiskType::FXVol] = curvatureWeights_[CrifRecord::RiskType::IRVol];
477 curvatureWeights_[CrifRecord::RiskType::CreditVolNonQ] = curvatureWeights_[CrifRecord::RiskType::CreditVol];
478
479 }
480
481
482 // Valid risk types
484 CrifRecord::RiskType::Commodity,
485 CrifRecord::RiskType::CommodityVol,
486 CrifRecord::RiskType::CreditNonQ,
487 CrifRecord::RiskType::CreditQ,
488 CrifRecord::RiskType::CreditVol,
489 CrifRecord::RiskType::CreditVolNonQ,
490 CrifRecord::RiskType::Equity,
491 CrifRecord::RiskType::EquityVol,
492 CrifRecord::RiskType::FX,
493 CrifRecord::RiskType::FXVol,
494 CrifRecord::RiskType::Inflation,
495 CrifRecord::RiskType::IRCurve,
496 CrifRecord::RiskType::IRVol,
497 CrifRecord::RiskType::InflationVol,
498 CrifRecord::RiskType::BaseCorr,
499 CrifRecord::RiskType::XCcyBasis,
500 CrifRecord::RiskType::ProductClassMultiplier,
501 CrifRecord::RiskType::AddOnNotionalFactor,
502 CrifRecord::RiskType::PV,
503 CrifRecord::RiskType::Notional,
504 CrifRecord::RiskType::AddOnFixedAmount
505 };
506
507 // Risk class correlation matrix
509 {{"", "InterestRate", "CreditQualifying"}, 0.32},
510 {{"", "InterestRate", "CreditNonQualifying"}, 0.19},
511 {{"", "InterestRate", "Equity"}, 0.33},
512 {{"", "InterestRate", "Commodity"}, 0.41},
513 {{"", "InterestRate", "FX"}, 0.28},
514 {{"", "CreditQualifying", "InterestRate"}, 0.32},
515 {{"", "CreditQualifying", "CreditNonQualifying"}, 0.45},
516 {{"", "CreditQualifying", "Equity"}, 0.69},
517 {{"", "CreditQualifying", "Commodity"}, 0.52},
518 {{"", "CreditQualifying", "FX"}, 0.42},
519 {{"", "CreditNonQualifying", "InterestRate"}, 0.19},
520 {{"", "CreditNonQualifying", "CreditQualifying"}, 0.45},
521 {{"", "CreditNonQualifying", "Equity"}, 0.48},
522 {{"", "CreditNonQualifying", "Commodity"}, 0.4},
523 {{"", "CreditNonQualifying", "FX"}, 0.14},
524 {{"", "Equity", "InterestRate"}, 0.33},
525 {{"", "Equity", "CreditQualifying"}, 0.69},
526 {{"", "Equity", "CreditNonQualifying"}, 0.48},
527 {{"", "Equity", "Commodity"}, 0.52},
528 {{"", "Equity", "FX"}, 0.34},
529 {{"", "Commodity", "InterestRate"}, 0.41},
530 {{"", "Commodity", "CreditQualifying"}, 0.52},
531 {{"", "Commodity", "CreditNonQualifying"}, 0.4},
532 {{"", "Commodity", "Equity"}, 0.52},
533 {{"", "Commodity", "FX"}, 0.38},
534 {{"", "FX", "InterestRate"}, 0.28},
535 {{"", "FX", "CreditQualifying"}, 0.42},
536 {{"", "FX", "CreditNonQualifying"}, 0.14},
537 {{"", "FX", "Equity"}, 0.34},
538 {{"", "FX", "Commodity"}, 0.38}
539 };
540
541 // FX correlations
542 temp = {
543 0.500, 0.280,
544 0.280, 0.690
545 };
546 fxRegVolCorrelation_ = Matrix(2, 2, temp.begin(), temp.end());
547
548 temp = {
549 0.850, 0.390,
550 0.390, 0.500
551 };
552 fxHighVolCorrelation_ = Matrix(2, 2, temp.begin(), temp.end());
553
554 // Interest rate tenor correlations (i.e. Label1 level correlations)
555 intraBucketCorrelation_[CrifRecord::RiskType::IRCurve] = {
556 {{"", "2w", "1m"}, 0.75},
557 {{"", "2w", "3m"}, 0.63},
558 {{"", "2w", "6m"}, 0.55},
559 {{"", "2w", "1y"}, 0.44},
560 {{"", "2w", "2y"}, 0.35},
561 {{"", "2w", "3y"}, 0.31},
562 {{"", "2w", "5y"}, 0.26},
563 {{"", "2w", "10y"}, 0.21},
564 {{"", "2w", "15y"}, 0.17},
565 {{"", "2w", "20y"}, 0.15},
566 {{"", "2w", "30y"}, 0.14},
567 {{"", "1m", "2w"}, 0.75},
568 {{"", "1m", "3m"}, 0.79},
569 {{"", "1m", "6m"}, 0.68},
570 {{"", "1m", "1y"}, 0.51},
571 {{"", "1m", "2y"}, 0.4},
572 {{"", "1m", "3y"}, 0.33},
573 {{"", "1m", "5y"}, 0.28},
574 {{"", "1m", "10y"}, 0.22},
575 {{"", "1m", "15y"}, 0.17},
576 {{"", "1m", "20y"}, 0.15},
577 {{"", "1m", "30y"}, 0.15},
578 {{"", "3m", "2w"}, 0.63},
579 {{"", "3m", "1m"}, 0.79},
580 {{"", "3m", "6m"}, 0.85},
581 {{"", "3m", "1y"}, 0.67},
582 {{"", "3m", "2y"}, 0.53},
583 {{"", "3m", "3y"}, 0.45},
584 {{"", "3m", "5y"}, 0.38},
585 {{"", "3m", "10y"}, 0.31},
586 {{"", "3m", "15y"}, 0.23},
587 {{"", "3m", "20y"}, 0.21},
588 {{"", "3m", "30y"}, 0.22},
589 {{"", "6m", "2w"}, 0.55},
590 {{"", "6m", "1m"}, 0.68},
591 {{"", "6m", "3m"}, 0.85},
592 {{"", "6m", "1y"}, 0.82},
593 {{"", "6m", "2y"}, 0.7},
594 {{"", "6m", "3y"}, 0.61},
595 {{"", "6m", "5y"}, 0.53},
596 {{"", "6m", "10y"}, 0.44},
597 {{"", "6m", "15y"}, 0.36},
598 {{"", "6m", "20y"}, 0.35},
599 {{"", "6m", "30y"}, 0.33},
600 {{"", "1y", "2w"}, 0.44},
601 {{"", "1y", "1m"}, 0.51},
602 {{"", "1y", "3m"}, 0.67},
603 {{"", "1y", "6m"}, 0.82},
604 {{"", "1y", "2y"}, 0.94},
605 {{"", "1y", "3y"}, 0.86},
606 {{"", "1y", "5y"}, 0.78},
607 {{"", "1y", "10y"}, 0.66},
608 {{"", "1y", "15y"}, 0.6},
609 {{"", "1y", "20y"}, 0.58},
610 {{"", "1y", "30y"}, 0.56},
611 {{"", "2y", "2w"}, 0.35},
612 {{"", "2y", "1m"}, 0.4},
613 {{"", "2y", "3m"}, 0.53},
614 {{"", "2y", "6m"}, 0.7},
615 {{"", "2y", "1y"}, 0.94},
616 {{"", "2y", "3y"}, 0.96},
617 {{"", "2y", "5y"}, 0.9},
618 {{"", "2y", "10y"}, 0.8},
619 {{"", "2y", "15y"}, 0.75},
620 {{"", "2y", "20y"}, 0.72},
621 {{"", "2y", "30y"}, 0.71},
622 {{"", "3y", "2w"}, 0.31},
623 {{"", "3y", "1m"}, 0.33},
624 {{"", "3y", "3m"}, 0.45},
625 {{"", "3y", "6m"}, 0.61},
626 {{"", "3y", "1y"}, 0.86},
627 {{"", "3y", "2y"}, 0.96},
628 {{"", "3y", "5y"}, 0.97},
629 {{"", "3y", "10y"}, 0.88},
630 {{"", "3y", "15y"}, 0.83},
631 {{"", "3y", "20y"}, 0.8},
632 {{"", "3y", "30y"}, 0.78},
633 {{"", "5y", "2w"}, 0.26},
634 {{"", "5y", "1m"}, 0.28},
635 {{"", "5y", "3m"}, 0.38},
636 {{"", "5y", "6m"}, 0.53},
637 {{"", "5y", "1y"}, 0.78},
638 {{"", "5y", "2y"}, 0.9},
639 {{"", "5y", "3y"}, 0.97},
640 {{"", "5y", "10y"}, 0.95},
641 {{"", "5y", "15y"}, 0.91},
642 {{"", "5y", "20y"}, 0.88},
643 {{"", "5y", "30y"}, 0.87},
644 {{"", "10y", "2w"}, 0.21},
645 {{"", "10y", "1m"}, 0.22},
646 {{"", "10y", "3m"}, 0.31},
647 {{"", "10y", "6m"}, 0.44},
648 {{"", "10y", "1y"}, 0.66},
649 {{"", "10y", "2y"}, 0.8},
650 {{"", "10y", "3y"}, 0.88},
651 {{"", "10y", "5y"}, 0.95},
652 {{"", "10y", "15y"}, 0.97},
653 {{"", "10y", "20y"}, 0.95},
654 {{"", "10y", "30y"}, 0.95},
655 {{"", "15y", "2w"}, 0.17},
656 {{"", "15y", "1m"}, 0.17},
657 {{"", "15y", "3m"}, 0.23},
658 {{"", "15y", "6m"}, 0.36},
659 {{"", "15y", "1y"}, 0.6},
660 {{"", "15y", "2y"}, 0.75},
661 {{"", "15y", "3y"}, 0.83},
662 {{"", "15y", "5y"}, 0.91},
663 {{"", "15y", "10y"}, 0.97},
664 {{"", "15y", "20y"}, 0.98},
665 {{"", "15y", "30y"}, 0.98},
666 {{"", "20y", "2w"}, 0.15},
667 {{"", "20y", "1m"}, 0.15},
668 {{"", "20y", "3m"}, 0.21},
669 {{"", "20y", "6m"}, 0.35},
670 {{"", "20y", "1y"}, 0.58},
671 {{"", "20y", "2y"}, 0.72},
672 {{"", "20y", "3y"}, 0.8},
673 {{"", "20y", "5y"}, 0.88},
674 {{"", "20y", "10y"}, 0.95},
675 {{"", "20y", "15y"}, 0.98},
676 {{"", "20y", "30y"}, 0.99},
677 {{"", "30y", "2w"}, 0.14},
678 {{"", "30y", "1m"}, 0.15},
679 {{"", "30y", "3m"}, 0.22},
680 {{"", "30y", "6m"}, 0.33},
681 {{"", "30y", "1y"}, 0.56},
682 {{"", "30y", "2y"}, 0.71},
683 {{"", "30y", "3y"}, 0.78},
684 {{"", "30y", "5y"}, 0.87},
685 {{"", "30y", "10y"}, 0.95},
686 {{"", "30y", "15y"}, 0.98},
687 {{"", "30y", "20y"}, 0.99}
688 };
689
690 // CreditQ inter-bucket correlations
691 interBucketCorrelation_[CrifRecord::RiskType::CreditQ] = {
692 {{"", "1", "2"}, 0.35},
693 {{"", "1", "3"}, 0.37},
694 {{"", "1", "4"}, 0.35},
695 {{"", "1", "5"}, 0.37},
696 {{"", "1", "6"}, 0.34},
697 {{"", "1", "7"}, 0.38},
698 {{"", "1", "8"}, 0.31},
699 {{"", "1", "9"}, 0.34},
700 {{"", "1", "10"}, 0.33},
701 {{"", "1", "11"}, 0.3},
702 {{"", "1", "12"}, 0.31},
703 {{"", "2", "1"}, 0.35},
704 {{"", "2", "3"}, 0.44},
705 {{"", "2", "4"}, 0.43},
706 {{"", "2", "5"}, 0.45},
707 {{"", "2", "6"}, 0.42},
708 {{"", "2", "7"}, 0.32},
709 {{"", "2", "8"}, 0.34},
710 {{"", "2", "9"}, 0.38},
711 {{"", "2", "10"}, 0.38},
712 {{"", "2", "11"}, 0.35},
713 {{"", "2", "12"}, 0.35},
714 {{"", "3", "1"}, 0.37},
715 {{"", "3", "2"}, 0.44},
716 {{"", "3", "4"}, 0.48},
717 {{"", "3", "5"}, 0.49},
718 {{"", "3", "6"}, 0.47},
719 {{"", "3", "7"}, 0.34},
720 {{"", "3", "8"}, 0.35},
721 {{"", "3", "9"}, 0.42},
722 {{"", "3", "10"}, 0.42},
723 {{"", "3", "11"}, 0.4},
724 {{"", "3", "12"}, 0.39},
725 {{"", "4", "1"}, 0.35},
726 {{"", "4", "2"}, 0.43},
727 {{"", "4", "3"}, 0.48},
728 {{"", "4", "5"}, 0.48},
729 {{"", "4", "6"}, 0.48},
730 {{"", "4", "7"}, 0.32},
731 {{"", "4", "8"}, 0.34},
732 {{"", "4", "9"}, 0.4},
733 {{"", "4", "10"}, 0.41},
734 {{"", "4", "11"}, 0.39},
735 {{"", "4", "12"}, 0.37},
736 {{"", "5", "1"}, 0.37},
737 {{"", "5", "2"}, 0.45},
738 {{"", "5", "3"}, 0.49},
739 {{"", "5", "4"}, 0.48},
740 {{"", "5", "6"}, 0.48},
741 {{"", "5", "7"}, 0.34},
742 {{"", "5", "8"}, 0.35},
743 {{"", "5", "9"}, 0.41},
744 {{"", "5", "10"}, 0.41},
745 {{"", "5", "11"}, 0.4},
746 {{"", "5", "12"}, 0.39},
747 {{"", "6", "1"}, 0.34},
748 {{"", "6", "2"}, 0.42},
749 {{"", "6", "3"}, 0.47},
750 {{"", "6", "4"}, 0.48},
751 {{"", "6", "5"}, 0.48},
752 {{"", "6", "7"}, 0.31},
753 {{"", "6", "8"}, 0.33},
754 {{"", "6", "9"}, 0.37},
755 {{"", "6", "10"}, 0.38},
756 {{"", "6", "11"}, 0.38},
757 {{"", "6", "12"}, 0.36},
758 {{"", "7", "1"}, 0.38},
759 {{"", "7", "2"}, 0.32},
760 {{"", "7", "3"}, 0.34},
761 {{"", "7", "4"}, 0.32},
762 {{"", "7", "5"}, 0.34},
763 {{"", "7", "6"}, 0.31},
764 {{"", "7", "8"}, 0.28},
765 {{"", "7", "9"}, 0.32},
766 {{"", "7", "10"}, 0.3},
767 {{"", "7", "11"}, 0.27},
768 {{"", "7", "12"}, 0.28},
769 {{"", "8", "1"}, 0.31},
770 {{"", "8", "2"}, 0.34},
771 {{"", "8", "3"}, 0.35},
772 {{"", "8", "4"}, 0.34},
773 {{"", "8", "5"}, 0.35},
774 {{"", "8", "6"}, 0.33},
775 {{"", "8", "7"}, 0.28},
776 {{"", "8", "9"}, 0.32},
777 {{"", "8", "10"}, 0.32},
778 {{"", "8", "11"}, 0.29},
779 {{"", "8", "12"}, 0.29},
780 {{"", "9", "1"}, 0.34},
781 {{"", "9", "2"}, 0.38},
782 {{"", "9", "3"}, 0.42},
783 {{"", "9", "4"}, 0.4},
784 {{"", "9", "5"}, 0.41},
785 {{"", "9", "6"}, 0.37},
786 {{"", "9", "7"}, 0.32},
787 {{"", "9", "8"}, 0.32},
788 {{"", "9", "10"}, 0.38},
789 {{"", "9", "11"}, 0.35},
790 {{"", "9", "12"}, 0.35},
791 {{"", "10", "1"}, 0.33},
792 {{"", "10", "2"}, 0.38},
793 {{"", "10", "3"}, 0.42},
794 {{"", "10", "4"}, 0.41},
795 {{"", "10", "5"}, 0.41},
796 {{"", "10", "6"}, 0.38},
797 {{"", "10", "7"}, 0.3},
798 {{"", "10", "8"}, 0.32},
799 {{"", "10", "9"}, 0.38},
800 {{"", "10", "11"}, 0.35},
801 {{"", "10", "12"}, 0.34},
802 {{"", "11", "1"}, 0.3},
803 {{"", "11", "2"}, 0.35},
804 {{"", "11", "3"}, 0.4},
805 {{"", "11", "4"}, 0.39},
806 {{"", "11", "5"}, 0.4},
807 {{"", "11", "6"}, 0.38},
808 {{"", "11", "7"}, 0.27},
809 {{"", "11", "8"}, 0.29},
810 {{"", "11", "9"}, 0.35},
811 {{"", "11", "10"}, 0.35},
812 {{"", "11", "12"}, 0.33},
813 {{"", "12", "1"}, 0.31},
814 {{"", "12", "2"}, 0.35},
815 {{"", "12", "3"}, 0.39},
816 {{"", "12", "4"}, 0.37},
817 {{"", "12", "5"}, 0.39},
818 {{"", "12", "6"}, 0.36},
819 {{"", "12", "7"}, 0.28},
820 {{"", "12", "8"}, 0.29},
821 {{"", "12", "9"}, 0.35},
822 {{"", "12", "10"}, 0.34},
823 {{"", "12", "11"}, 0.33}
824 };
825
826 // Equity inter-bucket correlations
827 interBucketCorrelation_[CrifRecord::RiskType::Equity] = {
828 {{"", "1", "3"}, 0.21},
829 {{"", "1", "4"}, 0.21},
830 {{"", "1", "5"}, 0.15},
831 {{"", "1", "6"}, 0.19},
832 {{"", "1", "7"}, 0.19},
833 {{"", "1", "8"}, 0.19},
834 {{"", "1", "9"}, 0.18},
835 {{"", "1", "10"}, 0.14},
836 {{"", "1", "11"}, 0.24},
837 {{"", "1", "12"}, 0.24},
838 {{"", "2", "1"}, 0.2},
839 {{"", "2", "3"}, 0.25},
840 {{"", "2", "4"}, 0.24},
841 {{"", "2", "5"}, 0.16},
842 {{"", "2", "6"}, 0.21},
843 {{"", "2", "7"}, 0.22},
844 {{"", "2", "8"}, 0.21},
845 {{"", "2", "9"}, 0.21},
846 {{"", "2", "10"}, 0.16},
847 {{"", "2", "11"}, 0.27},
848 {{"", "2", "12"}, 0.27},
849 {{"", "3", "1"}, 0.21},
850 {{"", "3", "2"}, 0.25},
851 {{"", "3", "4"}, 0.26},
852 {{"", "3", "5"}, 0.17},
853 {{"", "3", "6"}, 0.22},
854 {{"", "3", "7"}, 0.24},
855 {{"", "3", "8"}, 0.22},
856 {{"", "3", "9"}, 0.23},
857 {{"", "3", "10"}, 0.17},
858 {{"", "3", "11"}, 0.28},
859 {{"", "3", "12"}, 0.28},
860 {{"", "4", "1"}, 0.21},
861 {{"", "4", "2"}, 0.24},
862 {{"", "4", "3"}, 0.26},
863 {{"", "4", "5"}, 0.18},
864 {{"", "4", "6"}, 0.24},
865 {{"", "4", "7"}, 0.25},
866 {{"", "4", "8"}, 0.25},
867 {{"", "4", "9"}, 0.23},
868 {{"", "4", "10"}, 0.19},
869 {{"", "4", "11"}, 0.31},
870 {{"", "4", "12"}, 0.31},
871 {{"", "5", "1"}, 0.15},
872 {{"", "5", "2"}, 0.16},
873 {{"", "5", "3"}, 0.17},
874 {{"", "5", "4"}, 0.18},
875 {{"", "5", "6"}, 0.27},
876 {{"", "5", "7"}, 0.27},
877 {{"", "5", "8"}, 0.27},
878 {{"", "5", "9"}, 0.15},
879 {{"", "5", "10"}, 0.2},
880 {{"", "5", "11"}, 0.32},
881 {{"", "5", "12"}, 0.32},
882 {{"", "6", "1"}, 0.19},
883 {{"", "6", "2"}, 0.21},
884 {{"", "6", "3"}, 0.22},
885 {{"", "6", "4"}, 0.24},
886 {{"", "6", "5"}, 0.27},
887 {{"", "6", "7"}, 0.36},
888 {{"", "6", "8"}, 0.35},
889 {{"", "6", "9"}, 0.2},
890 {{"", "6", "10"}, 0.25},
891 {{"", "6", "11"}, 0.42},
892 {{"", "6", "12"}, 0.42},
893 {{"", "7", "1"}, 0.19},
894 {{"", "7", "2"}, 0.22},
895 {{"", "7", "3"}, 0.24},
896 {{"", "7", "4"}, 0.25},
897 {{"", "7", "5"}, 0.27},
898 {{"", "7", "6"}, 0.36},
899 {{"", "7", "8"}, 0.34},
900 {{"", "7", "9"}, 0.2},
901 {{"", "7", "10"}, 0.26},
902 {{"", "7", "11"}, 0.43},
903 {{"", "7", "12"}, 0.43},
904 {{"", "8", "1"}, 0.19},
905 {{"", "8", "2"}, 0.21},
906 {{"", "8", "3"}, 0.22},
907 {{"", "8", "4"}, 0.25},
908 {{"", "8", "5"}, 0.27},
909 {{"", "8", "6"}, 0.35},
910 {{"", "8", "7"}, 0.34},
911 {{"", "8", "9"}, 0.2},
912 {{"", "8", "10"}, 0.25},
913 {{"", "8", "11"}, 0.41},
914 {{"", "8", "12"}, 0.41},
915 {{"", "9", "1"}, 0.18},
916 {{"", "9", "2"}, 0.21},
917 {{"", "9", "3"}, 0.23},
918 {{"", "9", "4"}, 0.23},
919 {{"", "9", "5"}, 0.15},
920 {{"", "9", "6"}, 0.2},
921 {{"", "9", "7"}, 0.2},
922 {{"", "9", "8"}, 0.2},
923 {{"", "9", "10"}, 0.16},
924 {{"", "9", "11"}, 0.26},
925 {{"", "9", "12"}, 0.26},
926 {{"", "10", "1"}, 0.14},
927 {{"", "10", "2"}, 0.16},
928 {{"", "10", "3"}, 0.17},
929 {{"", "10", "4"}, 0.19},
930 {{"", "10", "5"}, 0.2},
931 {{"", "10", "6"}, 0.25},
932 {{"", "10", "7"}, 0.26},
933 {{"", "10", "8"}, 0.25},
934 {{"", "10", "9"}, 0.16},
935 {{"", "10", "11"}, 0.29},
936 {{"", "10", "12"}, 0.29},
937 {{"", "11", "1"}, 0.24},
938 {{"", "11", "2"}, 0.27},
939 {{"", "11", "3"}, 0.28},
940 {{"", "11", "4"}, 0.31},
941 {{"", "11", "5"}, 0.32},
942 {{"", "11", "6"}, 0.42},
943 {{"", "11", "7"}, 0.43},
944 {{"", "11", "8"}, 0.41},
945 {{"", "11", "9"}, 0.26},
946 {{"", "11", "10"}, 0.29},
947 {{"", "11", "12"}, 0.54},
948 {{"", "12", "1"}, 0.24},
949 {{"", "12", "2"}, 0.27},
950 {{"", "12", "3"}, 0.28},
951 {{"", "12", "4"}, 0.31},
952 {{"", "12", "5"}, 0.32},
953 {{"", "12", "6"}, 0.42},
954 {{"", "12", "7"}, 0.43},
955 {{"", "12", "8"}, 0.41},
956 {{"", "12", "9"}, 0.26},
957 {{"", "12", "10"}, 0.29},
958 {{"", "12", "11"}, 0.54}
959 };
960
961 // Commodity inter-bucket correlations
962 interBucketCorrelation_[CrifRecord::RiskType::Commodity] = {
963 {{"", "1", "2"}, 0.36},
964 {{"", "1", "3"}, 0.23},
965 {{"", "1", "4"}, 0.3},
966 {{"", "1", "5"}, 0.3},
967 {{"", "1", "6"}, 0.07},
968 {{"", "1", "7"}, 0.32},
969 {{"", "1", "8"}, 0.02},
970 {{"", "1", "9"}, 0.26},
971 {{"", "1", "10"}, 0.2},
972 {{"", "1", "11"}, 0.17},
973 {{"", "1", "12"}, 0.15},
974 {{"", "1", "13"}, 0.21},
975 {{"", "1", "14"}, 0.15},
976 {{"", "1", "15"}, 0.19},
977 {{"", "1", "16"}, 0.0},
978 {{"", "1", "17"}, 0.24},
979 {{"", "2", "1"}, 0.36},
980 {{"", "2", "3"}, 0.93},
981 {{"", "2", "4"}, 0.94},
982 {{"", "2", "5"}, 0.88},
983 {{"", "2", "6"}, 0.16},
984 {{"", "2", "7"}, 0.21},
985 {{"", "2", "8"}, 0.09},
986 {{"", "2", "9"}, 0.21},
987 {{"", "2", "10"}, 0.2},
988 {{"", "2", "11"}, 0.4},
989 {{"", "2", "12"}, 0.3},
990 {{"", "2", "13"}, 0.24},
991 {{"", "2", "14"}, 0.29},
992 {{"", "2", "15"}, 0.23},
993 {{"", "2", "16"}, 0.0},
994 {{"", "2", "17"}, 0.56},
995 {{"", "3", "1"}, 0.23},
996 {{"", "3", "2"}, 0.93},
997 {{"", "3", "4"}, 0.91},
998 {{"", "3", "5"}, 0.85},
999 {{"", "3", "6"}, 0.06},
1000 {{"", "3", "7"}, 0.21},
1001 {{"", "3", "8"}, 0.04},
1002 {{"", "3", "9"}, 0.21},
1003 {{"", "3", "10"}, 0.19},
1004 {{"", "3", "11"}, 0.33},
1005 {{"", "3", "12"}, 0.23},
1006 {{"", "3", "13"}, 0.14},
1007 {{"", "3", "14"}, 0.23},
1008 {{"", "3", "15"}, 0.25},
1009 {{"", "3", "16"}, 0.0},
1010 {{"", "3", "17"}, 0.5},
1011 {{"", "4", "1"}, 0.3},
1012 {{"", "4", "2"}, 0.94},
1013 {{"", "4", "3"}, 0.91},
1014 {{"", "4", "5"}, 0.83},
1015 {{"", "4", "6"}, 0.06},
1016 {{"", "4", "7"}, 0.24},
1017 {{"", "4", "8"}, 0.04},
1018 {{"", "4", "9"}, 0.21},
1019 {{"", "4", "10"}, 0.17},
1020 {{"", "4", "11"}, 0.36},
1021 {{"", "4", "12"}, 0.25},
1022 {{"", "4", "13"}, 0.14},
1023 {{"", "4", "14"}, 0.25},
1024 {{"", "4", "15"}, 0.2},
1025 {{"", "4", "16"}, 0.0},
1026 {{"", "4", "17"}, 0.53},
1027 {{"", "5", "1"}, 0.3},
1028 {{"", "5", "2"}, 0.88},
1029 {{"", "5", "3"}, 0.85},
1030 {{"", "5", "4"}, 0.83},
1031 {{"", "5", "6"}, 0.1},
1032 {{"", "5", "7"}, 0.17},
1033 {{"", "5", "8"}, 0.04},
1034 {{"", "5", "9"}, 0.16},
1035 {{"", "5", "10"}, 0.17},
1036 {{"", "5", "11"}, 0.4},
1037 {{"", "5", "12"}, 0.33},
1038 {{"", "5", "13"}, 0.25},
1039 {{"", "5", "14"}, 0.3},
1040 {{"", "5", "15"}, 0.19},
1041 {{"", "5", "16"}, 0.0},
1042 {{"", "5", "17"}, 0.53},
1043 {{"", "6", "1"}, 0.07},
1044 {{"", "6", "2"}, 0.16},
1045 {{"", "6", "3"}, 0.06},
1046 {{"", "6", "4"}, 0.06},
1047 {{"", "6", "5"}, 0.1},
1048 {{"", "6", "7"}, 0.27},
1049 {{"", "6", "8"}, 0.5},
1050 {{"", "6", "9"}, 0.2},
1051 {{"", "6", "10"}, 0.04},
1052 {{"", "6", "11"}, 0.17},
1053 {{"", "6", "12"}, 0.08},
1054 {{"", "6", "13"}, 0.12},
1055 {{"", "6", "14"}, 0.08},
1056 {{"", "6", "15"}, 0.14},
1057 {{"", "6", "16"}, 0.0},
1058 {{"", "6", "17"}, 0.25},
1059 {{"", "7", "1"}, 0.32},
1060 {{"", "7", "2"}, 0.21},
1061 {{"", "7", "3"}, 0.21},
1062 {{"", "7", "4"}, 0.24},
1063 {{"", "7", "5"}, 0.17},
1064 {{"", "7", "6"}, 0.27},
1065 {{"", "7", "8"}, 0.27},
1066 {{"", "7", "9"}, 0.61},
1067 {{"", "7", "10"}, 0.18},
1068 {{"", "7", "11"}, 0.06},
1069 {{"", "7", "12"}, -0.11},
1070 {{"", "7", "13"}, 0.12},
1071 {{"", "7", "14"}, 0.08},
1072 {{"", "7", "15"}, 0.08},
1073 {{"", "7", "16"}, 0.0},
1074 {{"", "7", "17"}, 0.22},
1075 {{"", "8", "1"}, 0.02},
1076 {{"", "8", "2"}, 0.09},
1077 {{"", "8", "3"}, 0.04},
1078 {{"", "8", "4"}, 0.04},
1079 {{"", "8", "5"}, 0.04},
1080 {{"", "8", "6"}, 0.5},
1081 {{"", "8", "7"}, 0.27},
1082 {{"", "8", "9"}, 0.19},
1083 {{"", "8", "10"}, 0.0},
1084 {{"", "8", "11"}, 0.12},
1085 {{"", "8", "12"}, -0.03},
1086 {{"", "8", "13"}, 0.09},
1087 {{"", "8", "14"}, 0.05},
1088 {{"", "8", "15"}, 0.07},
1089 {{"", "8", "16"}, 0.0},
1090 {{"", "8", "17"}, 0.14},
1091 {{"", "9", "1"}, 0.26},
1092 {{"", "9", "2"}, 0.21},
1093 {{"", "9", "3"}, 0.21},
1094 {{"", "9", "4"}, 0.21},
1095 {{"", "9", "5"}, 0.16},
1096 {{"", "9", "6"}, 0.2},
1097 {{"", "9", "7"}, 0.61},
1098 {{"", "9", "8"}, 0.19},
1099 {{"", "9", "10"}, 0.14},
1100 {{"", "9", "11"}, 0.13},
1101 {{"", "9", "12"}, -0.07},
1102 {{"", "9", "13"}, 0.07},
1103 {{"", "9", "14"}, 0.06},
1104 {{"", "9", "15"}, 0.12},
1105 {{"", "9", "16"}, 0.0},
1106 {{"", "9", "17"}, 0.19},
1107 {{"", "10", "1"}, 0.2},
1108 {{"", "10", "2"}, 0.2},
1109 {{"", "10", "3"}, 0.19},
1110 {{"", "10", "4"}, 0.17},
1111 {{"", "10", "5"}, 0.17},
1112 {{"", "10", "6"}, 0.04},
1113 {{"", "10", "7"}, 0.18},
1114 {{"", "10", "8"}, 0.0},
1115 {{"", "10", "9"}, 0.4},
1116 {{"", "10", "11"}, 0.11},
1117 {{"", "10", "12"}, 0.13},
1118 {{"", "10", "13"}, 0.07},
1119 {{"", "10", "14"}, 0.06},
1120 {{"", "10", "15"}, 0.06},
1121 {{"", "10", "16"}, 0.0},
1122 {{"", "10", "17"}, 0.11},
1123 {{"", "11", "1"}, 0.17},
1124 {{"", "11", "2"}, 0.4},
1125 {{"", "11", "3"}, 0.33},
1126 {{"", "11", "4"}, 0.36},
1127 {{"", "11", "5"}, 0.4},
1128 {{"", "11", "6"}, 0.17},
1129 {{"", "11", "7"}, 0.06},
1130 {{"", "11", "8"}, 0.12},
1131 {{"", "11", "9"}, 0.13},
1132 {{"", "11", "10"}, 0.11},
1133 {{"", "11", "12"}, 0.31},
1134 {{"", "11", "13"}, 0.27},
1135 {{"", "11", "14"}, 0.21},
1136 {{"", "11", "15"}, 0.2},
1137 {{"", "11", "16"}, 0.0},
1138 {{"", "11", "17"}, 0.37},
1139 {{"", "12", "1"}, 0.15},
1140 {{"", "12", "2"}, 0.3},
1141 {{"", "12", "3"}, 0.23},
1142 {{"", "12", "4"}, 0.25},
1143 {{"", "12", "5"}, 0.33},
1144 {{"", "12", "6"}, 0.08},
1145 {{"", "12", "7"}, -0.11},
1146 {{"", "12", "8"}, -0.03},
1147 {{"", "12", "9"}, -0.07},
1148 {{"", "12", "10"}, 0.13},
1149 {{"", "12", "11"}, 0.31},
1150 {{"", "12", "13"}, 0.15},
1151 {{"", "12", "14"}, 0.19},
1152 {{"", "12", "15"}, 0.1},
1153 {{"", "12", "16"}, 0.0},
1154 {{"", "12", "17"}, 0.23},
1155 {{"", "13", "1"}, 0.21},
1156 {{"", "13", "2"}, 0.24},
1157 {{"", "13", "3"}, 0.14},
1158 {{"", "13", "4"}, 0.14},
1159 {{"", "13", "5"}, 0.25},
1160 {{"", "13", "6"}, 0.12},
1161 {{"", "13", "7"}, 0.12},
1162 {{"", "13", "8"}, 0.09},
1163 {{"", "13", "9"}, 0.07},
1164 {{"", "13", "10"}, 0.07},
1165 {{"", "13", "11"}, 0.27},
1166 {{"", "13", "12"}, 0.15},
1167 {{"", "13", "14"}, 0.28},
1168 {{"", "13", "15"}, 0.2},
1169 {{"", "13", "16"}, 0.0},
1170 {{"", "13", "17"}, 0.27},
1171 {{"", "14", "1"}, 0.15},
1172 {{"", "14", "2"}, 0.29},
1173 {{"", "14", "3"}, 0.23},
1174 {{"", "14", "4"}, 0.25},
1175 {{"", "14", "5"}, 0.3},
1176 {{"", "14", "6"}, 0.08},
1177 {{"", "14", "7"}, 0.08},
1178 {{"", "14", "8"}, 0.05},
1179 {{"", "14", "9"}, 0.06},
1180 {{"", "14", "10"}, 0.06},
1181 {{"", "14", "11"}, 0.21},
1182 {{"", "14", "12"}, 0.19},
1183 {{"", "14", "13"}, 0.28},
1184 {{"", "14", "15"}, 0.15},
1185 {{"", "14", "16"}, 0.0},
1186 {{"", "14", "17"}, 0.25},
1187 {{"", "15", "1"}, 0.19},
1188 {{"", "15", "2"}, 0.23},
1189 {{"", "15", "3"}, 0.25},
1190 {{"", "15", "4"}, 0.2},
1191 {{"", "15", "5"}, 0.19},
1192 {{"", "15", "6"}, 0.14},
1193 {{"", "15", "7"}, 0.08},
1194 {{"", "15", "8"}, 0.07},
1195 {{"", "15", "9"}, 0.12},
1196 {{"", "15", "10"}, 0.06},
1197 {{"", "15", "11"}, 0.2},
1198 {{"", "15", "12"}, 0.1},
1199 {{"", "15", "13"}, 0.2},
1200 {{"", "15", "14"}, 0.15},
1201 {{"", "15", "16"}, 0.0},
1202 {{"", "15", "17"}, 0.23},
1203 {{"", "16", "1"}, 0.0},
1204 {{"", "16", "2"}, 0.0},
1205 {{"", "16", "3"}, 0.0},
1206 {{"", "16", "4"}, 0.0},
1207 {{"", "16", "5"}, 0.0},
1208 {{"", "16", "6"}, 0.0},
1209 {{"", "16", "7"}, 0.0},
1210 {{"", "16", "8"}, 0.0},
1211 {{"", "16", "9"}, 0.0},
1212 {{"", "16", "10"}, 0.0},
1213 {{"", "16", "11"}, 0.0},
1214 {{"", "16", "12"}, 0.0},
1215 {{"", "16", "13"}, 0.0},
1216 {{"", "16", "14"}, 0.0},
1217 {{"", "16", "15"}, 0.0},
1218 {{"", "16", "17"}, 0.0},
1219 {{"", "17", "1"}, 0.24},
1220 {{"", "17", "2"}, 0.56},
1221 {{"", "17", "3"}, 0.5},
1222 {{"", "17", "4"}, 0.53},
1223 {{"", "17", "5"}, 0.53},
1224 {{"", "17", "6"}, 0.25},
1225 {{"", "17", "7"}, 0.22},
1226 {{"", "17", "8"}, 0.14},
1227 {{"", "17", "9"}, 0.19},
1228 {{"", "17", "10"}, 0.11},
1229 {{"", "17", "11"}, 0.37},
1230 {{"", "17", "12"}, 0.23},
1231 {{"", "17", "13"}, 0.27},
1232 {{"", "17", "14"}, 0.25},
1233 {{"", "17", "15"}, 0.23},
1234 {{"", "17", "16"}, 0.0}
1235 };
1236
1237 // Equity intra-bucket correlations (exclude Residual and deal with it in the method - it is 0%) - changed
1238 intraBucketCorrelation_[CrifRecord::RiskType::Equity] = {
1239 {{"1", "", ""}, 0.18},
1240 {{"2", "", ""}, 0.23},
1241 {{"3", "", ""}, 0.28},
1242 {{"4", "", ""}, 0.27},
1243 {{"5", "", ""}, 0.23},
1244 {{"6", "", ""}, 0.36},
1245 {{"7", "", ""}, 0.38},
1246 {{"8", "", ""}, 0.35},
1247 {{"9", "", ""}, 0.21},
1248 {{"10", "", ""}, 0.20},
1249 {{"11", "", ""}, 0.54},
1250 {{"12", "", ""}, 0.54}
1251 };
1252
1253 // Commodity intra-bucket correlations
1254 intraBucketCorrelation_[CrifRecord::RiskType::Commodity] = {
1255 {{"1", "", ""}, 0.79},
1256 {{"2", "", ""}, 0.98},
1257 {{"3", "", ""}, 0.96},
1258 {{"4", "", ""}, 0.97},
1259 {{"5", "", ""}, 0.98},
1260 {{"6", "", ""}, 0.88},
1261 {{"7", "", ""}, 0.97},
1262 {{"8", "", ""}, 0.42},
1263 {{"9", "", ""}, 0.70},
1264 {{"10", "", ""}, 0.38},
1265 {{"11", "", ""}, 0.54},
1266 {{"12", "", ""}, 0.48},
1267 {{"13", "", ""}, 0.67},
1268 {{"14", "", ""}, 0.15},
1269 {{"15", "", ""}, 0.23},
1270 {{"16", "", ""}, 0.00},
1271 {{"17", "", ""}, 0.33}
1272 };
1273
1274 // Initialise the single, ad-hoc type, correlations
1275 xccyCorr_ = 0.07;
1276 infCorr_ = 0.41;
1277 infVolCorr_ = 0.41;
1278 irSubCurveCorr_ = 0.986;
1279 irInterCurrencyCorr_ = 0.22;
1281 crqSameIntraCorr_ = 0.92;
1282 crqDiffIntraCorr_ = 0.41;
1284 crnqSameIntraCorr_ = 0.86;
1285 crnqDiffIntraCorr_ = 0.33;
1286 crnqInterCorr_ = 0.36;
1287 fxCorr_ = 0.5;
1288 basecorrCorr_ = 0.25;
1289
1290 // clang-format on
1291}
1292
1293/* The CurvatureMargin must be multiplied by a scale factor of HVR(IR)^{-2}, where HVR(IR)
1294is the historical volatility ratio for the interest-rate risk class (see page 8 section 11(d)
1295of the ISDA-SIMM-v2.3.8 documentation).
1296*/
1298
1300 // Call the shared implementation
1302}
1303
1304string SimmConfiguration_ISDA_V2_3_8::label2(const QuantLib::ext::shared_ptr<InterestRateIndex>& irIndex) const {
1305 // Special for BMA
1306 if (boost::algorithm::starts_with(irIndex->name(), "BMA")) {
1307 return "Municipal";
1308 }
1309
1310 // Otherwise pass off to base class
1311 return SimmConfigurationBase::label2(irIndex);
1312}
1313
1314} // namespace analytics
1315} // namespace ore
virtual std::string label2(const QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > &irIndex) const
QuantLib::Real correlation(const CrifRecord::RiskType &firstRt, const std::string &firstQualifier, const std::string &firstLabel_1, const std::string &firstLabel_2, const CrifRecord::RiskType &secondRt, const std::string &secondQualifier, const std::string &secondLabel_1, const std::string &secondLabel_2, const std::string &calculationCurrency="") const override
QuantLib::Real weight(const CrifRecord::RiskType &rt, boost::optional< std::string > qualifier=boost::none, boost::optional< std::string > label_1=boost::none, const std::string &calculationCurrency="") const override
SimmConfiguration_ISDA_V2_3_8(const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper, const QuantLib::Size &mporDays=10, const std::string &name="SIMM ISDA 2.3.8 (26 July 2021)", const std::string version="2.3.8")
QuantLib::Matrix fxRegVolCorrelation_
FX Correlations when the calculation ccy is in the Regular Volatility group.
QuantLib::Matrix fxHighVolCorrelation_
FX Correlations when the calculation ccy is in the High Volatility group.
std::string label2(const QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > &irIndex) const override
Return the SIMM Label2 value for the given interest rate index.
void addLabels2(const CrifRecord::RiskType &rt, const std::string &label_2) override
Add SIMM Label2 values under certain circumstances.
std::map< QuantLib::Size, std::set< std::string > > ccyGroups_
QuantLib::Real hvr_ir_
IR Historical volatility ratio.
QuantLib::Size group(const std::string &qualifier, const std::map< QuantLib::Size, std::set< std::string > > &groups) const
Find the group of the qualifier.
QuantLib::Real correlation(const CrifRecord::RiskType &firstRt, const std::string &firstQualifier, const std::string &firstLabel_1, const std::string &firstLabel_2, const CrifRecord::RiskType &secondRt, const std::string &secondQualifier, const std::string &secondLabel_1, const std::string &secondLabel_2, const std::string &calculationCurrency="") const override
QuantLib::Real crqResidualIntraCorr_
Credit-Q residual intra correlation.
QuantLib::Real basecorrCorr_
Base correlation risk factor correlation.
std::map< CrifRecord::RiskType, QuantLib::Real > rwRiskType_
QuantLib::Real weight(const CrifRecord::RiskType &rt, boost::optional< std::string > qualifier=boost::none, boost::optional< std::string > label_1=boost::none, const std::string &calculationCurrency="") const override
QuantLib::Real crnqResidualIntraCorr_
Credit-NonQ residual intra correlation.
QuantLib::Size mporDays() const
MPOR in days.
std::map< CrifRecord::RiskType, std::vector< std::string > > mapLabels_2_
QuantLib::Real irInterCurrencyCorr_
IR correlation across currencies.
std::map< CrifRecord::RiskType, Amounts > rwLabel_1_
std::map< CrifRecord::RiskType, Amounts > intraBucketCorrelation_
std::map< CrifRecord::RiskType, std::vector< std::string > > mapBuckets_
QuantLib::Real crnqDiffIntraCorr_
Credit-NonQ non-residual intra correlation when different underlying names.
QuantLib::Real crqSameIntraCorr_
Credit-Q non-residual intra correlation when same qualifier but different vertex/source.
QuantLib::Real crnqSameIntraCorr_
Credit-NonQ non-residual intra correlation when same underlying names.
std::set< CrifRecord::RiskType > validRiskTypes_
Set of valid risk types for the current configuration.
QuantLib::ext::shared_ptr< SimmConcentration > simmConcentration_
Used to get the concentration thresholds for a given risk type and qualifier.
QuantLib::Real infCorr_
Correlation between any yield and inflation in same currency.
Amounts riskClassCorrelation_
Risk class correlation matrix.
QuantLib::Real crnqInterCorr_
Credit-NonQ non-residual inter bucket correlation.
std::map< CrifRecord::RiskType, QuantLib::Real > historicalVolatilityRatios_
Map from risk type to a historical volatility ratio.
std::map< CrifRecord::RiskType, Amounts > interBucketCorrelation_
std::map< CrifRecord::RiskType, std::vector< std::string > > mapLabels_1_
QuantLib::Real infVolCorr_
Correlation between any yield volatility and inflation volatility in same currency.
QuantLib::Real crqDiffIntraCorr_
Credit-Q non-residual intra correlation when different qualifier.
QuantLib::Real irSubCurveCorr_
IR Label2 level i.e. sub-curve correlation.
void addLabels2Impl(const CrifRecord::RiskType &rt, const std::string &label_2)
A base implementation of addLabels2 that can be shared by derived classes.
std::map< CrifRecord::RiskType, std::vector< QuantLib::Real > > curvatureWeights_
QuantLib::ext::shared_ptr< SimmBucketMapper > simmBucketMapper_
Used to map SIMM Qualifier names to SIMM bucket values.
std::map< CrifRecord::RiskType, Amounts > rwBucket_
RandomVariable pow(RandomVariable x, const RandomVariable &y)
SIMM concentration thresholds for SIMM version 2.3.8.
SIMM configuration for SIMM version 2.3.8.
string name