Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_3.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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_3::SimmConcentration_ISDA_V2_3(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] = 240;
54 flatThresholds_[RiskType::CreditVolNonQ] = 56;
55
56 // Populate bucketed thresholds
57 bucketedThresholds_[RiskType::IRCurve] = {
58 { "1", 31 },
59 { "2", 220 },
60 { "3", 41 },
61 { "4", 99 }
62 };
63
64 bucketedThresholds_[RiskType::CreditQ] = {
65 { "1", 0.95 },
66 { "2", 0.18 },
67 { "3", 0.18 },
68 { "4", 0.18 },
69 { "5", 0.18 },
70 { "6", 0.18 },
71 { "7", 0.95 },
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", 7.3 },
88 { "2", 7.3 },
89 { "3", 7.3 },
90 { "4", 7.3 },
91 { "5", 30 },
92 { "6", 30 },
93 { "7", 30 },
94 { "8", 30 },
95 { "9", 2.4 },
96 { "10", 2.4 },
97 { "11", 1400 },
98 { "12", 1400 },
99 { "Residual", 2.4 }
100 };
101
102 bucketedThresholds_[RiskType::Commodity] = {
103 { "1", 310 },
104 { "2", 1700 },
105 { "3", 1300 },
106 { "4", 1300 },
107 { "5", 1300 },
108 { "6", 2800 },
109 { "7", 2800 },
110 { "8", 2200 },
111 { "9", 2200 },
112 { "10", 52 },
113 { "11", 490 },
114 { "12", 1300 },
115 { "13", 73 },
116 { "14", 73 },
117 { "15", 73 },
118 { "16", 52 },
119 { "17", 4000 }
120 };
121
122 bucketedThresholds_[RiskType::FX] = {
123 { "1", 8900 },
124 { "2", 2000 },
125 { "3", 250 }
126 };
127
128 bucketedThresholds_[RiskType::IRVol] = {
129 { "1", 93 },
130 { "2", 2400 },
131 { "3", 240 },
132 { "4", 740 }
133 };
134
135 bucketedThresholds_[RiskType::EquityVol] = {
136 { "1", 140 },
137 { "2", 140 },
138 { "3", 140 },
139 { "4", 140 },
140 { "5", 1600 },
141 { "6", 1600 },
142 { "7", 1600 },
143 { "8", 1600 },
144 { "9", 38 },
145 { "10", 240 },
146 { "11", 9800 },
147 { "12", 9800 },
148 { "Residual", 38 }
149 };
150
151 bucketedThresholds_[RiskType::CommodityVol] = {
152 { "1", 130 },
153 { "2", 1700 },
154 { "3", 290 },
155 { "4", 290 },
156 { "5", 290 },
157 { "6", 2300 },
158 { "7", 2300 },
159 { "8", 800 },
160 { "9", 800 },
161 { "10", 74 },
162 { "11", 420 },
163 { "12", 700 },
164 { "13", 560 },
165 { "14", 560 },
166 { "15", 560 },
167 { "16", 74 },
168 { "17", 300 }
169 };
170
171 bucketedThresholds_[RiskType::FXVol] = {
172 { "1", 3900 },
173 { "2", 1400 },
174 { "3", 640 },
175 { "4", 690 },
176 { "5", 440 },
177 { "6", 280 }
178 };
179
180 // clang-format on
181}
182
183Real SimmConcentration_ISDA_V2_3::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_3(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.3.