Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav2_5.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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_5::SimmConcentration_ISDA_V2_5(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper)
36 : simmBucketMapper_(simmBucketMapper) {
37
38 // Populate IR categories that are used for concentration thresholds
39 irCategories_ = {{"1", {}},{"2", {"USD", "EUR", "GBP"}},{"3", {"AUD", "CAD", "CHF", "DKK", "HKD", "KRW", "NOK", "NZD", "SEK", "SGD", "TWD"}},{"4", {"JPY"}}};
40
41 // Populate FX categories that are used for concentration thresholds
42 fxCategories_ = {{"1", {"USD", "EUR", "JPY", "GBP", "AUD", "CHF", "CAD"}},{"2", {"BRL", "CNY", "HKD", "INR", "KRW", "MXN", "NOK", "NZD", "RUB", "SEK", "SGD", "TRY", "ZAR"}},{"3", {}}};
43
44 // Initialise the data
45 // clang-format off
46
47 // Populate flat thresholds
48 flatThresholds_[RiskType::CreditVol] = 260;
49 flatThresholds_[RiskType::CreditVolNonQ] = 145;
50
51 // Populate bucketed thresholds
52 bucketedThresholds_[RiskType::IRCurve] = {
53 { "1", 33 },
54 { "2", 230 },
55 { "3", 44 },
56 { "4", 70 }
57 };
58
59 bucketedThresholds_[RiskType::CreditQ] = {
60 { "1", 0.91 },
61 { "2", 0.19 },
62 { "3", 0.19 },
63 { "4", 0.19 },
64 { "5", 0.19 },
65 { "6", 0.19 },
66 { "7", 0.91 },
67 { "8", 0.19 },
68 { "9", 0.19 },
69 { "10", 0.19 },
70 { "11", 0.19 },
71 { "12", 0.19 },
72 { "Residual", 0.19 }
73 };
74
75 bucketedThresholds_[RiskType::CreditNonQ] = {
76 { "1", 9.5 },
77 { "2", 0.5 },
78 { "Residual", 0.5 }
79 };
80
81 bucketedThresholds_[RiskType::Equity] = {
82 { "1", 10 },
83 { "2", 10 },
84 { "3", 10 },
85 { "4", 10 },
86 { "5", 21 },
87 { "6", 21 },
88 { "7", 21 },
89 { "8", 21 },
90 { "9", 1.4 },
91 { "10", 0.6 },
92 { "11", 2100 },
93 { "12", 2100 },
94 { "Residual", 0.6 }
95 };
96
97 bucketedThresholds_[RiskType::Commodity] = {
98 { "1", 310 },
99 { "2", 2100 },
100 { "3", 1700 },
101 { "4", 1700 },
102 { "5", 1700 },
103 { "6", 3200 },
104 { "7", 3200 },
105 { "8", 2700 },
106 { "9", 2700 },
107 { "10", 52 },
108 { "11", 530 },
109 { "12", 1600 },
110 { "13", 100 },
111 { "14", 100 },
112 { "15", 100 },
113 { "16", 52 },
114 { "17", 4000 }
115 };
116
117 bucketedThresholds_[RiskType::FX] = {
118 { "1", 5100 },
119 { "2", 1200 },
120 { "3", 190 }
121 };
122
123 bucketedThresholds_[RiskType::IRVol] = {
124 { "1", 120 },
125 { "2", 3300 },
126 { "3", 470 },
127 { "4", 570 }
128 };
129
130 bucketedThresholds_[RiskType::EquityVol] = {
131 { "1", 210 },
132 { "2", 210 },
133 { "3", 210 },
134 { "4", 210 },
135 { "5", 1300 },
136 { "6", 1300 },
137 { "7", 1300 },
138 { "8", 1300 },
139 { "9", 40 },
140 { "10", 200 },
141 { "11", 5900 },
142 { "12", 5900 },
143 { "Residual", 40 }
144 };
145
146 bucketedThresholds_[RiskType::CommodityVol] = {
147 { "1", 210 },
148 { "2", 2700 },
149 { "3", 290 },
150 { "4", 290 },
151 { "5", 290 },
152 { "6", 5000 },
153 { "7", 5000 },
154 { "8", 920 },
155 { "9", 920 },
156 { "10", 100 },
157 { "11", 350 },
158 { "12", 720 },
159 { "13", 500 },
160 { "14", 500 },
161 { "15", 500 },
162 { "16", 65 },
163 { "17", 65 }
164 };
165
166 bucketedThresholds_[RiskType::FXVol] = {
167 { "1", 2800 },
168 { "2", 1300 },
169 { "3", 550 },
170 { "4", 490 },
171 { "5", 310 },
172 { "6", 200 }
173 };
174
175 // clang-format on
176}
177
178Real SimmConcentration_ISDA_V2_5::threshold(const RiskType& riskType, const string& qualifier) const {
179 return thresholdImpl(simmBucketMapper_, riskType, qualifier);
180}
181
182} // namespace analytics
183} // namespace ore
SimmConcentration_ISDA_V2_5(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.5.