9#include <ql/errors.hpp>
26 const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper)
27 : simmBucketMapper_(simmBucketMapper) {
29 for (
const auto& [riskClass, rcData] : simmCalibration->riskClassData()) {
31 const auto& concThresholds = rcData->concentrationThresholds();
34 if (riskClass == RiskClass::InterestRate || riskClass == RiskClass::FX) {
35 const auto& irFxThresholds = QuantLib::ext::dynamic_pointer_cast<IRFXConcentrationThresholds>(concThresholds);
36 QL_REQUIRE(irFxThresholds,
"Cannot cast ConcentrationThresholds to IRFXConcentrationThresholds");
37 const auto& ccyLists = irFxThresholds->currencyLists();
40 for (
const auto& [ccyKey, ccyList] : ccyLists) {
41 const string& bucket = std::get<0>(ccyKey);
42 for (
const string& ccy : ccyList) {
44 categories[bucket].clear();
46 categories[bucket].insert(ccy);
52 const auto& delta = concThresholds->delta();
53 const auto& vega = concThresholds->vega();
58 if (delta.size() == 1) {
60 }
else if (delta.size() > 1) {
61 for (
const auto& [key, dTh] : delta) {
62 const string& bucket = std::get<0>(key);
68 if (vega.size() == 1) {
70 }
else if (vega.size() > 1) {
71 for (
const auto& [key, vTh] : vega) {
72 const string& bucket = std::get<0>(key);
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_
SimmConcentrationCalibration(const QuantLib::ext::shared_ptr< SimmCalibration > &simmCalibration, 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.
static std::pair< CrifRecord::RiskType, CrifRecord::RiskType > riskClassToRiskType(const RiskClass &rc)
For a given risk class, return the corresponding risk types.
Real parseReal(const string &s)
SimmCalibration::RiskClassData::IRFXConcentrationThresholds IRFXConcentrationThresholds
SimmConfiguration::RiskClass RiskClass
CrifRecord::RiskType RiskType
SIMM concentration thresholds built from SIMM calibration.
SIMM configuration interface.