Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_2.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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/errors.hpp>
22
23using namespace QuantLib;
24
25using std::map;
26using std::set;
27using std::string;
28
29namespace ore {
30namespace analytics {
31
32// Ease syntax
34
35SimmConcentration_ISDA_V2_2::SimmConcentration_ISDA_V2_2(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper)
36 : simmBucketMapper_(simmBucketMapper) {
37
38 // Populate IR categories that are used for concentration thresholds
39 irCategories_ = {{"1", {}},
40 {"2", {"USD", "EUR", "GBP"}},
41 {"3", {"AUD", "CAD", "CHF", "DKK", "HKD", "KRW", "NOK", "NZD", "SEK", "SGD", "TWD"}},
42 {"4", {"JPY"}}};
43
44 // Populate FX categories that are used for concentration thresholds
45 fxCategories_ = {{"1", {"USD", "EUR", "JPY", "GBP", "AUD", "CHF", "CAD"}},
46 {"2", {"BRL", "CNY", "HKD", "INR", "KRW", "MXN", "NOK", "NZD", "RUB", "SEK", "SGD", "TRY", "ZAR"}},
47 {"3", {}}};
48
49 // Initialise the data
50 // clang-format off
51
52 // Populate flat thresholds
53 flatThresholds_[RiskType::CreditVol] = 280;
54 flatThresholds_[RiskType::CreditVolNonQ] = 59;
55
56 // Populate bucketed thresholds
57 bucketedThresholds_[RiskType::IRCurve] = {
58 { "1", 6.9 },
59 { "2", 230 },
60 { "3", 30 },
61 { "4", 150 }
62 };
63
64 bucketedThresholds_[RiskType::CreditQ] = {
65 { "1", 0.94 },
66 { "2", 0.18 },
67 { "3", 0.18 },
68 { "4", 0.18 },
69 { "5", 0.18 },
70 { "6", 0.18 },
71 { "7", 0.94 },
72 { "8", 0.18 },
73 { "9", 0.18 },
74 { "10", 0.18 },
75 { "11", 0.18 },
76 { "12", 0.18 },
77 { "Residual", 0.18 }
78 };
79
80 bucketedThresholds_[RiskType::CreditNonQ] = {
81 { "1", 9.5 },
82 { "2", 0.5 },
83 { "Residual", 0.5 }
84 };
85
86 bucketedThresholds_[RiskType::Equity] = {
87 { "1", 11 },
88 { "2", 11 },
89 { "3", 11 },
90 { "4", 11 },
91 { "5", 37 },
92 { "6", 37 },
93 { "7", 37 },
94 { "8", 37 },
95 { "9", 5.1 },
96 { "10", 2.4 },
97 { "11", 1800 },
98 { "12", 1800 },
99 { "Residual", 2.4 }
100 };
101
102 bucketedThresholds_[RiskType::Commodity] = {
103 { "1", 250 },
104 { "2", 2300 },
105 { "3", 1600 },
106 { "4", 1600 },
107 { "5", 1600 },
108 { "6", 2200 },
109 { "7", 2200 },
110 { "8", 2200 },
111 { "9", 2200 },
112 { "10", 51 },
113 { "11", 370 },
114 { "12", 870 },
115 { "13", 27 },
116 { "14", 27 },
117 { "15", 27 },
118 { "16", 27 },
119 { "17", 4100 }
120 };
121
122 bucketedThresholds_[RiskType::FX] = {
123 { "1", 9100 },
124 { "2", 1600 },
125 { "3", 290 }
126 };
127
128 bucketedThresholds_[RiskType::IRVol] = {
129 { "1", 170 },
130 { "2", 2300 },
131 { "3", 190 },
132 { "4", 770 }
133 };
134
135 bucketedThresholds_[RiskType::EquityVol] = {
136 { "1", 150 },
137 { "2", 150 },
138 { "3", 150 },
139 { "4", 150 },
140 { "5", 1100 },
141 { "6", 1100 },
142 { "7", 1100 },
143 { "8", 1100 },
144 { "9", 40 },
145 { "10", 200 },
146 { "11", 9200 },
147 { "12", 9200 },
148 { "Residual", 40 }
149 };
150
151 bucketedThresholds_[RiskType::CommodityVol] = {
152 { "1", 290 },
153 { "2", 1500 },
154 { "3", 230 },
155 { "4", 230 },
156 { "5", 230 },
157 { "6", 2600 },
158 { "7", 2600 },
159 { "8", 900 },
160 { "9", 900 },
161 { "10", 100 },
162 { "11", 390 },
163 { "12", 600 },
164 { "13", 680 },
165 { "14", 680 },
166 { "15", 680 },
167 { "16", 100 },
168 { "17", 270 }
169 };
170
171 bucketedThresholds_[RiskType::FXVol] = {
172 { "1", 3700 },
173 { "2", 1900 },
174 { "3", 640 },
175 { "4", 570 },
176 { "5", 390 },
177 { "6", 220 }
178 };
179
180 // clang-format on
181}
182
183Real SimmConcentration_ISDA_V2_2::threshold(const RiskType& riskType, const string& qualifier) const {
184 return thresholdImpl(simmBucketMapper_, riskType, qualifier);
185}
186
187} // namespace analytics
188} // namespace ore
SimmConcentration_ISDA_V2_2(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.2.