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