Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav1_3_38.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
36 const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper)
37 : simmBucketMapper_(simmBucketMapper) {
38
39 // Populate IR categories that are used for concentration thresholds
40 irCategories_ = {{"1", {}},
41 {"2", {"USD", "EUR", "GBP"}},
42 {"3", {"AUD", "CAD", "CHF", "DKK", "HKD", "KRW", "NOK", "NZD", "SEK", "SGD", "TWD"}},
43 {"4", {"JPY"}}};
44
45 // Populate FX categories that are used for concentration thresholds
46 fxCategories_ = {{"1", {"USD", "EUR", "JPY", "GBP", "AUD", "CHF", "CAD"}},
47 {"2", {"BRL", "CNY", "HKD", "INR", "KRW", "MXN", "NOK", "NZD", "RUB", "SEK", "SGD", "TRY", "ZAR"}},
48 {"3", {}}};
49
50 // Initialise the data
51 // clang-format off
52
53 // Populate flat thresholds
54 flatThresholds_[RiskType::CreditVol] = 290;
55 flatThresholds_[RiskType::CreditVolNonQ] = 60;
56
57 // Populate bucketed thresholds
58 bucketedThresholds_[RiskType::IRCurve] = {
59 { "1", 8 },
60 { "2", 230 },
61 { "3", 28 },
62 { "4", 82 }
63 };
64
65 bucketedThresholds_[RiskType::CreditQ] = {
66 { "1", 0.95 },
67 { "2", 0.29 },
68 { "3", 0.29 },
69 { "4", 0.29 },
70 { "5", 0.29 },
71 { "6", 0.29 },
72 { "7", 0.95 },
73 { "8", 0.29 },
74 { "9", 0.29 },
75 { "10", 0.29 },
76 { "11", 0.29 },
77 { "12", 0.29 },
78 { "Residual", 0.29 }
79 };
80
81 bucketedThresholds_[RiskType::CreditNonQ] = {
82 { "1", 9.5 },
83 { "2", 0.5 },
84 { "Residual", 0.5 }
85 };
86
87 bucketedThresholds_[RiskType::Equity] = {
88 { "1", 3.3 },
89 { "2", 3.3 },
90 { "3", 3.3 },
91 { "4", 3.3 },
92 { "5", 30 },
93 { "6", 30 },
94 { "7", 30 },
95 { "8", 30 },
96 { "9", 0.6 },
97 { "10", 2.6 },
98 { "11", 900 },
99 { "12", 900 },
100 { "Residual", 0.6 }
101 };
102
103 bucketedThresholds_[RiskType::Commodity] = {
104 { "1", 1400 },
105 { "2", 20000 },
106 { "3", 3500 },
107 { "4", 3500 },
108 { "5", 3500 },
109 { "6", 6400 },
110 { "7", 6400 },
111 { "8", 2500 },
112 { "9", 2500 },
113 { "10", 300 },
114 { "11", 2900 },
115 { "12", 7600 },
116 { "13", 3900 },
117 { "14", 3900 },
118 { "15", 3900 },
119 { "16", 300 },
120 { "17", 12000 }
121 };
122
123 bucketedThresholds_[RiskType::FX] = {
124 { "1", 8400 },
125 { "2", 1900 },
126 { "3", 560 }
127 };
128
129 bucketedThresholds_[RiskType::IRVol] = {
130 { "1", 110 },
131 { "2", 2700 },
132 { "3", 150 },
133 { "4", 960 }
134 };
135
136 bucketedThresholds_[RiskType::EquityVol] = {
137 { "1", 810 },
138 { "2", 810 },
139 { "3", 810 },
140 { "4", 810 },
141 { "5", 7400 },
142 { "6", 7400 },
143 { "7", 7400 },
144 { "8", 7400 },
145 { "9", 70 },
146 { "10", 300 },
147 { "11", 32000 },
148 { "12", 32000 },
149 { "Residual", 70 }
150 };
151
152 bucketedThresholds_[RiskType::CommodityVol] = {
153 { "1", 250 },
154 { "2", 2000 },
155 { "3", 540 },
156 { "4", 540 },
157 { "5", 540 },
158 { "6", 1800 },
159 { "7", 1800 },
160 { "8", 870 },
161 { "9", 870 },
162 { "10", 220 },
163 { "11", 450 },
164 { "12", 740 },
165 { "13", 380 },
166 { "14", 380 },
167 { "15", 380 },
168 { "16", 220 },
169 { "17", 2400 }
170 };
171
172 bucketedThresholds_[RiskType::FXVol] = {
173 { "1", 4000 },
174 { "2", 1900 },
175 { "3", 320 },
176 { "4", 120 },
177 { "5", 120 },
178 { "6", 64 }
179 };
180
181 // clang-format on
182}
183
184Real SimmConcentration_ISDA_V1_3_38::threshold(const RiskType& riskType, const string& qualifier) const {
185 return thresholdImpl(simmBucketMapper_, riskType, qualifier);
186}
187
188} // namespace analytics
189} // namespace ore
SimmConcentration_ISDA_V1_3_38(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 1.3.38.