Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_6.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 Quaternion Risk Management Ltd
3 All rights reserved.
4*/
7#include <ql/errors.hpp>
8
9using namespace QuantLib;
10
11using std::map;
12using std::set;
13using std::string;
14
15namespace ore {
16namespace analytics {
17
18// Ease syntax
20
21SimmConcentration_ISDA_V2_6::SimmConcentration_ISDA_V2_6(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper)
22 : simmBucketMapper_(simmBucketMapper) {
23
24 // Populate IR categories that are used for concentration thresholds
25 irCategories_ = {{"1", {}},{"2", {"USD", "EUR", "GBP"}},{"3", {"AUD", "CAD", "CHF", "DKK", "HKD", "KRW", "NOK", "NZD", "SEK", "SGD", "TWD"}},{"4", {"JPY"}}};
26
27 // Populate FX categories that are used for concentration thresholds
28 fxCategories_ = {{"1", {"USD", "EUR", "JPY", "GBP", "AUD", "CHF", "CAD"}},{"2", {"BRL", "CNY", "HKD", "INR", "KRW", "MXN", "NOK", "NZD", "RUB", "SEK", "SGD", "TRY", "ZAR"}},{"3", {}}};
29
30 // Initialise the data
31 // clang-format off
32
33 // Populate flat thresholds
34 flatThresholds_[RiskType::CreditVol] = 360;
35 flatThresholds_[RiskType::CreditVolNonQ] = 70;
36
37 // Populate bucketed thresholds
38 bucketedThresholds_[RiskType::IRCurve] = {
39 { "1", 30 },
40 { "2", 330 },
41 { "3", 130 },
42 { "4", 61 }
43 };
44
45 bucketedThresholds_[RiskType::CreditQ] = {
46 { "1", 1 },
47 { "2", 0.17 },
48 { "3", 0.17 },
49 { "4", 0.17 },
50 { "5", 0.17 },
51 { "6", 0.17 },
52 { "7", 1 },
53 { "8", 0.17 },
54 { "9", 0.17 },
55 { "10", 0.17 },
56 { "11", 0.17 },
57 { "12", 0.17 },
58 { "Residual", 0.17 }
59 };
60
61 bucketedThresholds_[RiskType::CreditNonQ] = {
62 { "1", 9.5 },
63 { "2", 0.5 },
64 { "Residual", 0.5 }
65 };
66
67 bucketedThresholds_[RiskType::Equity] = {
68 { "1", 3 },
69 { "2", 3 },
70 { "3", 3 },
71 { "4", 3 },
72 { "5", 12 },
73 { "6", 12 },
74 { "7", 12 },
75 { "8", 12 },
76 { "9", 0.64 },
77 { "10", 0.37 },
78 { "11", 810 },
79 { "12", 810 },
80 { "Residual", 0.37 }
81 };
82
83 bucketedThresholds_[RiskType::Commodity] = {
84 { "1", 310 },
85 { "2", 2100 },
86 { "3", 1700 },
87 { "4", 1700 },
88 { "5", 1700 },
89 { "6", 2800 },
90 { "7", 2800 },
91 { "8", 2700 },
92 { "9", 2700 },
93 { "10", 52 },
94 { "11", 530 },
95 { "12", 1300 },
96 { "13", 100 },
97 { "14", 100 },
98 { "15", 100 },
99 { "16", 52 },
100 { "17", 4000 }
101 };
102
103 bucketedThresholds_[RiskType::FX] = {
104 { "1", 3300 },
105 { "2", 880 },
106 { "3", 170 }
107 };
108
109 bucketedThresholds_[RiskType::IRVol] = {
110 { "1", 74 },
111 { "2", 4900 },
112 { "3", 520 },
113 { "4", 970 }
114 };
115
116 bucketedThresholds_[RiskType::EquityVol] = {
117 { "1", 210 },
118 { "2", 210 },
119 { "3", 210 },
120 { "4", 210 },
121 { "5", 1300 },
122 { "6", 1300 },
123 { "7", 1300 },
124 { "8", 1300 },
125 { "9", 39 },
126 { "10", 190 },
127 { "11", 6400 },
128 { "12", 6400 },
129 { "Residual", 39 }
130 };
131
132 bucketedThresholds_[RiskType::CommodityVol] = {
133 { "1", 390 },
134 { "2", 2900 },
135 { "3", 310 },
136 { "4", 310 },
137 { "5", 310 },
138 { "6", 6300 },
139 { "7", 6300 },
140 { "8", 1200 },
141 { "9", 1200 },
142 { "10", 120 },
143 { "11", 390 },
144 { "12", 1300 },
145 { "13", 590 },
146 { "14", 590 },
147 { "15", 590 },
148 { "16", 69 },
149 { "17", 69 }
150 };
151
152 bucketedThresholds_[RiskType::FXVol] = {
153 { "1", 2800 },
154 { "2", 1400 },
155 { "3", 590 },
156 { "4", 520 },
157 { "5", 340 },
158 { "6", 210 }
159 };
160
161 // clang-format on
162}
163
164Real SimmConcentration_ISDA_V2_6::threshold(const RiskType& riskType, const string& qualifier) const {
165 return thresholdImpl(simmBucketMapper_, riskType, qualifier);
166}
167
168} // namespace analytics
169} // namespace ore
SimmConcentration_ISDA_V2_6(const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper)
Default constructor that adds fixed known mappings.
QuantLib::Real threshold(const CrifRecord::RiskType &riskType, const std::string &qualifier) const override
QuantLib::ext::shared_ptr< SimmBucketMapper > simmBucketMapper_
Help getting SIMM buckets from SIMM qualifiers.
std::map< std::string, std::set< std::string > > fxCategories_
std::map< std::string, std::set< std::string > > irCategories_
std::map< CrifRecord::RiskType, std::map< std::string, QuantLib::Real > > bucketedThresholds_
QuantLib::Real thresholdImpl(const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper, const CrifRecord::RiskType &riskType, const std::string &qualifier) const
std::map< CrifRecord::RiskType, QuantLib::Real > flatThresholds_
CrifRecord::RiskType RiskType
Definition: crifloader.cpp:92
SIMM concentration thresholds for SIMM version 2.6.