Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentrationisdav1_3.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_V1_3::SimmConcentration_ISDA_V1_3(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] = 210;
54 flatThresholds_[RiskType::CreditVolNonQ] = 49;
55
56 // Populate bucketed thresholds
57 bucketedThresholds_[RiskType::IRCurve] = {
58 { "1", 7.4 },
59 { "2", 250 },
60 { "3", 25 },
61 { "4", 170 }
62 };
63
64 bucketedThresholds_[RiskType::CreditQ] = {
65 { "1", 1.00 },
66 { "2", 0.36 },
67 { "3", 0.36 },
68 { "4", 0.36 },
69 { "5", 0.36 },
70 { "6", 0.36 },
71 { "7", 1.00 },
72 { "8", 0.36 },
73 { "9", 0.36 },
74 { "10", 0.36 },
75 { "11", 0.36 },
76 { "12", 0.36 },
77 { "Residual", 0.36 }
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.1 },
88 { "2", 3.1 },
89 { "3", 3.1 },
90 { "4", 3.1 },
91 { "5", 31 },
92 { "6", 31 },
93 { "7", 31 },
94 { "8", 31 },
95 { "9", 0.7 },
96 { "10", 2.1 },
97 { "11", 690 },
98 { "Residual", 0.7 }
99 };
100
101 bucketedThresholds_[RiskType::Commodity] = {
102 { "1", 700 },
103 { "2", 23000 },
104 { "3", 3200 },
105 { "4", 3800 },
106 { "5", 1800 },
107 { "6", 6500 },
108 { "7", 400 },
109 { "8", 45 },
110 { "9", 300 },
111 { "10", 1.2 },
112 { "11", 1800 },
113 { "12", 5600 },
114 { "13", 480 },
115 { "14", 750 },
116 { "15", 3.5 },
117 { "16", 1.2 }
118 };
119
120 bucketedThresholds_[RiskType::FX] = {
121 { "1", 5200 },
122 { "2", 1300 },
123 { "3", 260 }
124 };
125
126 bucketedThresholds_[RiskType::IRVol] = {
127 { "1", 120 },
128 { "2", 3070 },
129 { "3", 160 },
130 { "4", 960 }
131 };
132
133 bucketedThresholds_[RiskType::EquityVol] = {
134 { "1", 1100 },
135 { "2", 1100 },
136 { "3", 1100 },
137 { "4", 1100 },
138 { "5", 11000 },
139 { "6", 11000 },
140 { "7", 11000 },
141 { "8", 11000 },
142 { "9", 170 },
143 { "10", 500 },
144 { "11", 39000 },
145 { "Residual", 170 }
146 };
147
148 bucketedThresholds_[RiskType::CommodityVol] = {
149 { "1", 4.9 },
150 { "2", 1900 },
151 { "3", 330 },
152 { "4", 590 },
153 { "5", 590 },
154 { "6", 560 },
155 { "7", 350 },
156 { "8", 120 },
157 { "9", 330 },
158 { "10", 110 },
159 { "11", 400 },
160 { "12", 420 },
161 { "13", 56 },
162 { "14", 66 },
163 { "15", 26 },
164 { "16", 27 }
165 };
166
167 bucketedThresholds_[RiskType::FXVol] = {
168 { "1", 5500 },
169 { "2", 3020 },
170 { "3", 520 },
171 { "4", 87 },
172 { "5", 87 },
173 { "6", 87 }
174 };
175
176 // clang-format on
177}
178
179Real SimmConcentration_ISDA_V1_3::threshold(const RiskType& riskType, const string& qualifier) const {
180 return thresholdImpl(simmBucketMapper_, riskType, qualifier);
181}
182
183} // namespace analytics
184} // namespace ore
SimmConcentration_ISDA_V1_3(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 R1.3 (3.29)