Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_0.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_0::SimmConcentration_ISDA_V2_0(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] = 290;
54 flatThresholds_[RiskType::CreditVolNonQ] = 65;
55
56 // Populate bucketed thresholds
57 bucketedThresholds_[RiskType::IRCurve] = {
58 { "1", 8 },
59 { "2", 230 },
60 { "3", 28 },
61 { "4", 82 }
62 };
63
64 bucketedThresholds_[RiskType::CreditQ] = {
65 { "1", 0.95 },
66 { "2", 0.29 },
67 { "3", 0.29 },
68 { "4", 0.29 },
69 { "5", 0.29 },
70 { "6", 0.29 },
71 { "7", 0.95 },
72 { "8", 0.29 },
73 { "9", 0.29 },
74 { "10", 0.29 },
75 { "11", 0.29 },
76 { "12", 0.29 },
77 { "Residual", 0.29 }
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", 3.3 },
88 { "2", 3.3 },
89 { "3", 3.3 },
90 { "4", 3.3 },
91 { "5", 30 },
92 { "6", 30 },
93 { "7", 30 },
94 { "8", 30 },
95 { "9", 0.6 },
96 { "10", 2.3 },
97 { "11", 900 },
98 { "12", 900 },
99 { "Residual", 0.6 }
100 };
101
102 bucketedThresholds_[RiskType::Commodity] = {
103 { "1", 1400 },
104 { "2", 20000 },
105 { "3", 3500 },
106 { "4", 3500 },
107 { "5", 3500 },
108 { "6", 6400 },
109 { "7", 6400 },
110 { "8", 2500 },
111 { "9", 2500 },
112 { "10", 300 },
113 { "11", 2900 },
114 { "12", 7600 },
115 { "13", 3900 },
116 { "14", 3900 },
117 { "15", 3900 },
118 { "16", 300 },
119 { "17", 12000 }
120 };
121
122 bucketedThresholds_[RiskType::FX] = {
123 { "1", 8400 },
124 { "2", 1900 },
125 { "3", 560 }
126 };
127
128 bucketedThresholds_[RiskType::IRVol] = {
129 { "1", 110 },
130 { "2", 2700 },
131 { "3", 150 },
132 { "4", 960 }
133 };
134
135 bucketedThresholds_[RiskType::EquityVol] = {
136 { "1", 800 },
137 { "2", 800 },
138 { "3", 800 },
139 { "4", 800 },
140 { "5", 7300 },
141 { "6", 7300 },
142 { "7", 7300 },
143 { "8", 7300 },
144 { "9", 70 },
145 { "10", 300 },
146 { "11", 21000 },
147 { "12", 21000 },
148 { "Residual", 70 }
149 };
150
151 bucketedThresholds_[RiskType::CommodityVol] = {
152 { "1", 250 },
153 { "2", 2000 },
154 { "3", 510 },
155 { "4", 510 },
156 { "5", 510 },
157 { "6", 1900 },
158 { "7", 1900 },
159 { "8", 870 },
160 { "9", 870 },
161 { "10", 220 },
162 { "11", 450 },
163 { "12", 740 },
164 { "13", 370 },
165 { "14", 370 },
166 { "15", 370 },
167 { "16", 220 },
168 { "17", 430 }
169 };
170
171 bucketedThresholds_[RiskType::FXVol] = {
172 { "1", 4000 },
173 { "2", 1900 },
174 { "3", 320 },
175 { "4", 120 },
176 { "5", 110 },
177 { "6", 110 }
178 };
179
180 // clang-format on
181}
182
183Real SimmConcentration_ISDA_V2_0::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_0(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)