Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_1.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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_1::SimmConcentration_ISDA_V2_1(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] = 250;
54 flatThresholds_[RiskType::CreditVolNonQ] = 54;
55
56 // Populate bucketed thresholds
57 bucketedThresholds_[RiskType::IRCurve] = {
58 { "1", 12 },
59 { "2", 210 },
60 { "3", 27 },
61 { "4", 170 }
62 };
63
64 bucketedThresholds_[RiskType::CreditQ] = {
65 { "1", 1.0 },
66 { "2", 0.24 },
67 { "3", 0.24 },
68 { "4", 0.24 },
69 { "5", 0.24 },
70 { "6", 0.24 },
71 { "7", 1.0 },
72 { "8", 0.24 },
73 { "9", 0.24 },
74 { "10", 0.24 },
75 { "11", 0.24 },
76 { "12", 0.24 },
77 { "Residual", 0.24 }
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", 8.4 },
88 { "2", 8.4 },
89 { "3", 8.4 },
90 { "4", 8.4 },
91 { "5", 26 },
92 { "6", 26 },
93 { "7", 26 },
94 { "8", 26 },
95 { "9", 1.8 },
96 { "10", 1.9 },
97 { "11", 540 },
98 { "12", 540 },
99 { "Residual", 1.8 }
100 };
101
102 bucketedThresholds_[RiskType::Commodity] = {
103 { "1", 700 },
104 { "2", 3600 },
105 { "3", 2700 },
106 { "4", 2700 },
107 { "5", 2700 },
108 { "6", 2600 },
109 { "7", 2600 },
110 { "8", 1900 },
111 { "9", 1900 },
112 { "10", 52 },
113 { "11", 2000 },
114 { "12", 3200 },
115 { "13", 1100 },
116 { "14", 1100 },
117 { "15", 1100 },
118 { "16", 52 },
119 { "17", 5200 }
120 };
121
122 bucketedThresholds_[RiskType::FX] = {
123 { "1", 9700 },
124 { "2", 2900 },
125 { "3", 450 }
126 };
127
128 bucketedThresholds_[RiskType::IRVol] = {
129 { "1", 120 },
130 { "2", 2200 },
131 { "3", 190 },
132 { "4", 770 }
133 };
134
135 bucketedThresholds_[RiskType::EquityVol] = {
136 { "1", 220 },
137 { "2", 220 },
138 { "3", 220 },
139 { "4", 220 },
140 { "5", 2300 },
141 { "6", 2300 },
142 { "7", 2300 },
143 { "8", 2300 },
144 { "9", 43 },
145 { "10", 250 },
146 { "11", 8100 },
147 { "12", 8100 },
148 { "Residual", 43 }
149 };
150
151 bucketedThresholds_[RiskType::CommodityVol] = {
152 { "1", 250 },
153 { "2", 1800 },
154 { "3", 320 },
155 { "4", 320 },
156 { "5", 320 },
157 { "6", 2200 },
158 { "7", 2200 },
159 { "8", 780 },
160 { "9", 780 },
161 { "10", 99 },
162 { "11", 420 },
163 { "12", 650 },
164 { "13", 570 },
165 { "14", 570 },
166 { "15", 570 },
167 { "16", 99 },
168 { "17", 330 }
169 };
170
171 bucketedThresholds_[RiskType::FXVol] = {
172 { "1", 2000 },
173 { "2", 1000 },
174 { "3", 320 },
175 { "4", 410 },
176 { "5", 210 },
177 { "6", 150 }
178 };
179
180 // clang-format on
181}
182
183Real SimmConcentration_ISDA_V2_1::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_1(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.0 (1.3.44)