Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
simmconcentration.hpp
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
19/*! \file orea/simm/simmconcentration.hpp
20 \brief Abstract base class for retrieving SIMM concentration thresholds
21*/
22
23#pragma once
24
27#include <ql/qldefines.hpp>
28#include <ql/types.hpp>
29
30#include <string>
31
32namespace ore {
33namespace analytics {
34
36public:
37 //! Destructor
38 virtual ~SimmConcentration() {}
39
40 /*! Return the SIMM <em>concentration threshold</em> for a given SIMM
41 <em>RiskType</em> and SIMM <em>Qualifier</em>.
42 */
43 virtual QuantLib::Real threshold(const CrifRecord::RiskType& riskType,
44 const std::string& qualifier) const = 0;
45};
46
48public:
49 //SimmConcentrationBase(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper,
50 // const QuantLib::ext::shared_ptr<SimmCalibration>& simmCalibration = nullptr);
51
52 /*! Default ctor. May need to generalise if units of threshold quotation
53 change significantly
54 */
56
57 /*! Early versions of SIMM did not have concentration thresholds assigned.
58 This base class just returns the maximum real number i.e. effectively
59 no concentration threshold
60 */
61 QuantLib::Real threshold(const CrifRecord::RiskType& riskType, const std::string& qualifier) const override {
62 return QL_MAX_REAL;
63 }
64
65protected:
66 //! The units of quotation of the threshold amount e.g. $1MM
67 QuantLib::Real units_;
68
69 /*! Map from SIMM <em>RiskType</em> to another map that holds the
70 SIMM concentration threshold <em>bucket</em> to threshold value mappings
71 */
72 std::map<CrifRecord::RiskType, QuantLib::Real> flatThresholds_;
73
74 /*! Map from SIMM <em>RiskType</em> to another map that holds the
75 SIMM concentration threshold <em>bucket</em> to threshold value mappings
76 */
77 std::map<CrifRecord::RiskType, std::map<std::string, QuantLib::Real>> bucketedThresholds_;
78
79 /*! Map defining the currency groupings for IR concentration thresholds i.e. key is the
80 category and value is the set of currencies in that category.
81 */
82 std::map<std::string, std::set<std::string>> irCategories_;
83
84 /*! Map defining the currency groupings for concentration thresholds i.e. key is the
85 category and value is the set of currencies in that category.
86 */
87 std::map<std::string, std::set<std::string>> fxCategories_;
88
89 //! Maps SIMM qualifiers to SIMM buckets
90 QuantLib::ext::shared_ptr<SimmBucketMapper> simmBucketMapper_;
91
92 /*! Shared threshold implementation for derived classes to call
93 */
94 QuantLib::Real thresholdImpl(const QuantLib::ext::shared_ptr<SimmBucketMapper>& simmBucketMapper,
95 const CrifRecord::RiskType& riskType, const std::string& qualifier) const;
96
97 //! Return concentration threshold for <em>Risk_FXVol</em> given the \p fxPair
98 QuantLib::Real fxVolThreshold(const std::string& fxPair) const;
99
100 //! Find the concentration threshold category of the \p qualifier
101 std::string category(const std::string& qualifier,
102 const std::map<std::string, std::set<std::string>>& categories) const;
103};
104
105} // namespace analytics
106} // namespace ore
QuantLib::Real units_
The units of quotation of the threshold amount e.g. $1MM.
QuantLib::Real fxVolThreshold(const std::string &fxPair) const
Return concentration threshold for Risk_FXVol given the fxPair.
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 threshold(const CrifRecord::RiskType &riskType, const std::string &qualifier) const override
QuantLib::Real thresholdImpl(const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper, const CrifRecord::RiskType &riskType, const std::string &qualifier) const
std::string category(const std::string &qualifier, const std::map< std::string, std::set< std::string > > &categories) const
Find the concentration threshold category of the qualifier.
std::map< CrifRecord::RiskType, QuantLib::Real > flatThresholds_
QuantLib::ext::shared_ptr< SimmBucketMapper > simmBucketMapper_
Maps SIMM qualifiers to SIMM buckets.
virtual QuantLib::Real threshold(const CrifRecord::RiskType &riskType, const std::string &qualifier) const =0
SIMM class for defining SIMM risk weights, thresholds, buckets, and labels. Currently only supports t...
SIMM configuration interface.