Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_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/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_8::SimmConcentration_ISDA_V2_3_8(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] = 310;
54 flatThresholds_[RiskType::CreditVolNonQ] = 85;
55
56 // Populate bucketed thresholds
57 bucketedThresholds_[RiskType::IRCurve] = {
58 { "1", 22 },
59 { "2", 240 },
60 { "3", 44 },
61 { "4", 120 }
62 };
63
64 bucketedThresholds_[RiskType::CreditQ] = {
65 { "1", 0.49 },
66 { "2", 0.22 },
67 { "3", 0.22 },
68 { "4", 0.22 },
69 { "5", 0.22 },
70 { "6", 0.22 },
71 { "7", 0.49 },
72 { "8", 0.22 },
73 { "9", 0.22 },
74 { "10", 0.22 },
75 { "11", 0.22 },
76 { "12", 0.22 },
77 { "Residual", 0.22 }
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", 9.0 },
88 { "2", 9.0 },
89 { "3", 9.0 },
90 { "4", 9.0 },
91 { "5", 18 },
92 { "6", 18 },
93 { "7", 18 },
94 { "8", 18 },
95 { "9", 1.2 },
96 { "10", 0.9 },
97 { "11", 1300 },
98 { "12", 1300 },
99 { "Residual", 0.9 }
100 };
101
102 bucketedThresholds_[RiskType::Commodity] = {
103 { "1", 310 },
104 { "2", 2100 },
105 { "3", 1700 },
106 { "4", 1700 },
107 { "5", 1700 },
108 { "6", 3200 },
109 { "7", 3200 },
110 { "8", 2700 },
111 { "9", 2700 },
112 { "10", 52 },
113 { "11", 600 },
114 { "12", 1600 },
115 { "13", 100 },
116 { "14", 100 },
117 { "15", 100 },
118 { "16", 52 },
119 { "17", 4000 }
120 };
121
122 bucketedThresholds_[RiskType::FX] = {
123 { "1", 8300 },
124 { "2", 1900 },
125 { "3", 240 }
126 };
127
128 bucketedThresholds_[RiskType::IRVol] = {
129 { "1", 83 },
130 { "2", 2600 },
131 { "3", 270 },
132 { "4", 980 }
133 };
134
135 bucketedThresholds_[RiskType::EquityVol] = {
136 { "1", 160 },
137 { "2", 160 },
138 { "3", 160 },
139 { "4", 160 },
140 { "5", 1600 },
141 { "6", 1600 },
142 { "7", 1600 },
143 { "8", 1600 },
144 { "9", 38 },
145 { "10", 260 },
146 { "11", 7000 },
147 { "12", 7000 },
148 { "Residual", 38 }
149 };
150
151 bucketedThresholds_[RiskType::CommodityVol] = {
152 { "1", 160 },
153 { "2", 2600 },
154 { "3", 280 },
155 { "4", 280 },
156 { "5", 280 },
157 { "6", 3500 },
158 { "7", 3500 },
159 { "8", 750 },
160 { "9", 750 },
161 { "10", 89 },
162 { "11", 340 },
163 { "12", 720 },
164 { "13", 500 },
165 { "14", 500 },
166 { "15", 500 },
167 { "16", 63 },
168 { "17", 63 }
169 };
170
171 bucketedThresholds_[RiskType::FXVol] = {
172 { "1", 3000 },
173 { "2", 1400 },
174 { "3", 610 },
175 { "4", 640 },
176 { "5", 420 },
177 { "6", 240 }
178 };
179
180 // clang-format on
181}
182
183Real SimmConcentration_ISDA_V2_3_8::threshold(const RiskType& riskType, const string& qualifier) const {
184 return thresholdImpl(simmBucketMapper_, riskType, qualifier);
185}
186
187} // namespace analytics
188} // namespace ore
QuantLib::Real threshold(const CrifRecord::RiskType &riskType, const std::string &qualifier) const override
SimmConcentration_ISDA_V2_3_8(const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper)
Default constructor that adds fixed known mappings.
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.8.