|
| 1 | +/* |
| 2 | + Copyright (C) 2025 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 | + |
| 19 | +#include <orea/simm/simmconcentrationisdav2_8_2506.hpp> |
| 20 | +#include <ored/utilities/log.hpp> |
| 21 | +#include <ql/errors.hpp> |
| 22 | + |
| 23 | +using namespace QuantLib; |
| 24 | + |
| 25 | +using std::map; |
| 26 | +using std::set; |
| 27 | +using std::string; |
| 28 | + |
| 29 | +namespace ore { |
| 30 | +namespace analytics { |
| 31 | + |
| 32 | +SimmConcentration_ISDA_V2_8_2506::SimmConcentration_ISDA_V2_8_2506(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper) |
| 33 | + : simmBucketMapper_(simmBucketMapper) { |
| 34 | + |
| 35 | + // Populate IR categories that are used for concentration thresholds |
| 36 | + irCategories_ = {{"1", {}},{"2", {"EUR", "GBP", "USD"}},{"3", {"AUD", "CAD", "CHF", "DKK", "HKD", "KRW", "NOK", "NZD", "SEK", "SGD", "TWD"}},{"4", {"JPY"}}}; |
| 37 | + |
| 38 | + // Populate FX categories that are used for concentration thresholds |
| 39 | + fxCategories_ = {{"1", {"AUD", "CAD", "CHF", "EUR", "GBP", "JPY", "USD"}},{"2", {"BRL", "CNY", "HKD", "INR", "KRW", "MXN", "NOK", "NZD", "RUB", "SEK", "SGD", "TRY", "ZAR"}},{"3", {}}}; |
| 40 | + |
| 41 | + // Initialise the data |
| 42 | + // clang-format off |
| 43 | + |
| 44 | + // Populate flat thresholds |
| 45 | + flatThresholds_[CrifRecord::RiskType::CreditVol] = 270; |
| 46 | + flatThresholds_[CrifRecord::RiskType::CreditVolNonQ] = 22; |
| 47 | + |
| 48 | + // Populate bucketed thresholds |
| 49 | + bucketedThresholds_[CrifRecord::RiskType::IRCurve] = { |
| 50 | + { "1", 51 }, |
| 51 | + { "2", 210 }, |
| 52 | + { "3", 100 }, |
| 53 | + { "4", 230 } |
| 54 | + }; |
| 55 | + |
| 56 | + bucketedThresholds_[CrifRecord::RiskType::CreditQ] = { |
| 57 | + { "1", 1.0 }, |
| 58 | + { "2", 0.19 }, |
| 59 | + { "3", 0.19 }, |
| 60 | + { "4", 0.19 }, |
| 61 | + { "5", 0.19 }, |
| 62 | + { "6", 0.19 }, |
| 63 | + { "7", 1.0 }, |
| 64 | + { "8", 0.19 }, |
| 65 | + { "9", 0.19 }, |
| 66 | + { "10", 0.19 }, |
| 67 | + { "11", 0.19 }, |
| 68 | + { "12", 0.19 }, |
| 69 | + { "Residual", 0.19 } |
| 70 | + }; |
| 71 | + |
| 72 | + bucketedThresholds_[CrifRecord::RiskType::CreditNonQ] = { |
| 73 | + { "1", 4.2 }, |
| 74 | + { "2", 0.19 }, |
| 75 | + { "Residual", 0.19 } |
| 76 | + }; |
| 77 | + |
| 78 | + bucketedThresholds_[CrifRecord::RiskType::Equity] = { |
| 79 | + { "1", 2.8 }, |
| 80 | + { "2", 2.8 }, |
| 81 | + { "3", 2.8 }, |
| 82 | + { "4", 2.8 }, |
| 83 | + { "5", 14 }, |
| 84 | + { "6", 14 }, |
| 85 | + { "7", 14 }, |
| 86 | + { "8", 14 }, |
| 87 | + { "9", 0.70 }, |
| 88 | + { "10", 0.33 }, |
| 89 | + { "11", 730 }, |
| 90 | + { "12", 730 }, |
| 91 | + { "Residual", 0.33 } |
| 92 | + }; |
| 93 | + |
| 94 | + bucketedThresholds_[CrifRecord::RiskType::Commodity] = { |
| 95 | + { "1", 310 }, |
| 96 | + { "2", 2500 }, |
| 97 | + { "3", 1700 }, |
| 98 | + { "4", 1700 }, |
| 99 | + { "5", 1700 }, |
| 100 | + { "6", 2300 }, |
| 101 | + { "7", 2300 }, |
| 102 | + { "8", 1800 }, |
| 103 | + { "9", 1800 }, |
| 104 | + { "10", 52 }, |
| 105 | + { "11", 530 }, |
| 106 | + { "12", 1600 }, |
| 107 | + { "13", 100 }, |
| 108 | + { "14", 100 }, |
| 109 | + { "15", 100 }, |
| 110 | + { "16", 52 }, |
| 111 | + { "17", 4000 } |
| 112 | + }; |
| 113 | + |
| 114 | + bucketedThresholds_[CrifRecord::RiskType::FX] = { |
| 115 | + { "1", 3100 }, |
| 116 | + { "2", 950 }, |
| 117 | + { "3", 160 } |
| 118 | + }; |
| 119 | + |
| 120 | + bucketedThresholds_[CrifRecord::RiskType::IRVol] = { |
| 121 | + { "1", 110 }, |
| 122 | + { "2", 4400 }, |
| 123 | + { "3", 480 }, |
| 124 | + { "4", 860 } |
| 125 | + }; |
| 126 | + |
| 127 | + bucketedThresholds_[CrifRecord::RiskType::EquityVol] = { |
| 128 | + { "1", 270 }, |
| 129 | + { "2", 270 }, |
| 130 | + { "3", 270 }, |
| 131 | + { "4", 270 }, |
| 132 | + { "5", 780 }, |
| 133 | + { "6", 780 }, |
| 134 | + { "7", 780 }, |
| 135 | + { "8", 780 }, |
| 136 | + { "9", 84 }, |
| 137 | + { "10", 290 }, |
| 138 | + { "11", 3200 }, |
| 139 | + { "12", 3200 }, |
| 140 | + { "Residual", 84 } |
| 141 | + }; |
| 142 | + |
| 143 | + bucketedThresholds_[CrifRecord::RiskType::CommodityVol] = { |
| 144 | + { "1", 480 }, |
| 145 | + { "2", 2400 }, |
| 146 | + { "3", 250 }, |
| 147 | + { "4", 250 }, |
| 148 | + { "5", 250 }, |
| 149 | + { "6", 7000 }, |
| 150 | + { "7", 7000 }, |
| 151 | + { "8", 1300 }, |
| 152 | + { "9", 1300 }, |
| 153 | + { "10", 100 }, |
| 154 | + { "11", 520 }, |
| 155 | + { "12", 740 }, |
| 156 | + { "13", 790 }, |
| 157 | + { "14", 790 }, |
| 158 | + { "15", 790 }, |
| 159 | + { "16", 62 }, |
| 160 | + { "17", 62 } |
| 161 | + }; |
| 162 | + |
| 163 | + bucketedThresholds_[CrifRecord::RiskType::FXVol] = { |
| 164 | + { "1", 2800 }, |
| 165 | + { "2", 1400 }, |
| 166 | + { "3", 740 }, |
| 167 | + { "4", 670 }, |
| 168 | + { "5", 440 }, |
| 169 | + { "6", 270 } |
| 170 | + }; |
| 171 | + |
| 172 | + // clang-format on |
| 173 | +} |
| 174 | + |
| 175 | +Real SimmConcentration_ISDA_V2_8_2506::threshold(const CrifRecord::RiskType& riskType, const string& qualifier) const { |
| 176 | + return thresholdImpl(simmBucketMapper_, riskType, qualifier); |
| 177 | +} |
| 178 | + |
| 179 | +} // namespace analytics |
| 180 | +} // namespace ore |
0 commit comments