#include <orea/simm/simmconfigurationbase.hpp>
Public Types | |
typedef std::map< std::tuple< std::string, std::string, std::string >, QuantLib::Real > | Amounts |
Public Types inherited from SimmConfiguration | |
enum class | SimmSide { Call , Post } |
Enum indicating the relevant side of the SIMM calculation. More... | |
enum class | RiskClass { InterestRate , CreditQualifying , CreditNonQualifying , Equity , Commodity , FX , All } |
enum class | MarginType { Delta , Vega , Curvature , BaseCorr , AdditionalIM , All } |
enum class | IMModel { Schedule , SIMM , SIMM_R , SIMM_P } |
enum | Regulation { APRA , CFTC , ESA , FINMA , KFSC , HKMA , JFSA , MAS , OSFI , RBI , SEC , SEC_unseg , USPR , NONREG , BACEN , SANT , SFC , UK , AMFQ , Included , Unspecified , Invalid } |
SIMM regulators. More... | |
Public Member Functions | |
const std::string & | name () const override |
Returns the SIMM configuration name. More... | |
const std::string & | version () const override |
Returns the SIMM configuration version. More... | |
const QuantLib::ext::shared_ptr< SimmBucketMapper > & | bucketMapper () const override |
Returns the SIMM bucket mapper used by the configuration. More... | |
bool | hasBuckets (const CrifRecord::RiskType &rt) const override |
Return true if the SIMM risk type rt has buckets. More... | |
std::string | bucket (const CrifRecord::RiskType &rt, const std::string &qualifier) const override |
const bool | checkValue (const std::string &, const std::vector< std::string > &) const |
std::vector< std::string > | buckets (const CrifRecord::RiskType &rt) const override |
std::vector< std::string > | labels1 (const CrifRecord::RiskType &rt) const override |
std::vector< std::string > | labels2 (const CrifRecord::RiskType &rt) const override |
void | addLabels2 (const CrifRecord::RiskType &rt, const std::string &label_2) override |
Add SIMM Label2 values under certain circumstances. More... | |
QuantLib::Real | weight (const CrifRecord::RiskType &rt, boost::optional< std::string > qualifier=boost::none, boost::optional< std::string > label_1=boost::none, const std::string &calculationCurrency="") const override |
QuantLib::Real | curvatureWeight (const CrifRecord::RiskType &rt, const std::string &label_1) const override |
QuantLib::Real | historicalVolatilityRatio (const CrifRecord::RiskType &rt) const override |
QuantLib::Real | sigma (const CrifRecord::RiskType &rt, boost::optional< std::string > qualifier=boost::none, boost::optional< std::string > label_1=boost::none, const std::string &calculationCurrency="") const override |
QuantLib::Real | curvatureMarginScaling () const override |
QuantLib::Real | concentrationThreshold (const CrifRecord::RiskType &rt, const std::string &qualifier) const override |
bool | isValidRiskType (const CrifRecord::RiskType &rt) const override |
QuantLib::Real | correlationRiskClasses (const RiskClass &rc_1, const RiskClass &rc_2) const override |
Return the correlation between SIMM risk classes rc_1 and rc_2 . More... | |
QuantLib::Real | correlation (const CrifRecord::RiskType &firstRt, const std::string &firstQualifier, const std::string &firstLabel_1, const std::string &firstLabel_2, const CrifRecord::RiskType &secondRt, const std::string &secondQualifier, const std::string &secondLabel_1, const std::string &secondLabel_2, const std::string &calculationCurrency="") const override |
QuantLib::Size | mporDays () const |
MPOR in days. More... | |
Public Member Functions inherited from SimmConfiguration | |
virtual | ~SimmConfiguration () |
virtual std::vector< std::string > | buckets (const CrifRecord::RiskType &rt) const =0 |
virtual bool | hasBuckets (const CrifRecord::RiskType &rt) const =0 |
Return true if the SIMM risk type rt has buckets. More... | |
bool | hasBucketMapping (const CrifRecord::RiskType &rt, const std::string &qualifier) const override |
Return true if the SIMM risk type rt has buckets. More... | |
virtual std::vector< std::string > | labels1 (const CrifRecord::RiskType &rt) const =0 |
virtual std::vector< std::string > | labels2 (const CrifRecord::RiskType &rt) const =0 |
virtual void | addLabels2 (const CrifRecord::RiskType &rt, const std::string &label_2)=0 |
virtual QuantLib::Real | weight (const CrifRecord::RiskType &rt, boost::optional< std::string > qualifier=boost::none, boost::optional< std::string > label_1=boost::none, const std::string &calculationCurrency="") const =0 |
virtual QuantLib::Real | curvatureWeight (const CrifRecord::RiskType &rt, const std::string &label_1) const =0 |
virtual QuantLib::Real | historicalVolatilityRatio (const CrifRecord::RiskType &rt) const =0 |
virtual QuantLib::Real | sigma (const CrifRecord::RiskType &rt, boost::optional< std::string > qualifier=boost::none, boost::optional< std::string > label_1=boost::none, const std::string &calculationCurrency="") const =0 |
virtual QuantLib::Real | curvatureMarginScaling () const =0 |
virtual QuantLib::Real | concentrationThreshold (const CrifRecord::RiskType &rt, const std::string &qualifier) const =0 |
virtual bool | isValidRiskType (const CrifRecord::RiskType &rt) const =0 |
virtual QuantLib::Real | correlationRiskClasses (const RiskClass &rc_1, const RiskClass &rc_2) const =0 |
Return the correlation between SIMM risk classes rc_1 and rc_2 . More... | |
virtual QuantLib::Real | correlation (const CrifRecord::RiskType &firstRt, const std::string &firstQualifier, const std::string &firstLabel_1, const std::string &firstLabel_2, const CrifRecord::RiskType &secondRt, const std::string &secondQualifier, const std::string &secondLabel_1, const std::string &secondLabel_2, const std::string &calculationCurrency="") const =0 |
virtual bool | isSimmConfigCalibration () const |
Public Member Functions inherited from CrifConfiguration | |
virtual | ~CrifConfiguration () |
virtual const std::string & | name () const =0 |
Returns the SIMM configuration name. More... | |
virtual const std::string & | version () const =0 |
Returns the SIMM configuration version. More... | |
virtual std::string | bucket (const ore::analytics::CrifRecord::RiskType &rt, const std::string &qualifier) const =0 |
virtual bool | hasBucketMapping (const ore::analytics::CrifRecord::RiskType &rt, const std::string &qualifier) const =0 |
virtual const QuantLib::ext::shared_ptr< SimmBucketMapper > & | bucketMapper () const =0 |
Returns the SIMM bucket mapper used by the configuration. More... | |
virtual std::string | label2 (const QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > &irIndex) const |
virtual std::string | label2 (const QuantLib::Period &p) const |
Protected Member Functions | |
SimmConfigurationBase (const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper, const std::string &name, const std::string version, QuantLib::Size mporDays=10) | |
Constructor taking the SIMM configuration name and version . More... | |
const std::tuple< std::string, std::string, std::string > | makeKey (const std::string &, const std::string &, const std::string &) const |
QuantLib::Size | labelIndex (const std::string &label, const std::vector< std::string > &labels) const |
Helper method to find the index of the label in labels . More... | |
void | addLabels2Impl (const CrifRecord::RiskType &rt, const std::string &label_2) |
A base implementation of addLabels2 that can be shared by derived classes. More... | |
Protected Attributes | |
std::string | version_ |
SIMM configuration version. More... | |
QuantLib::ext::shared_ptr< SimmBucketMapper > | simmBucketMapper_ |
Used to map SIMM Qualifier names to SIMM bucket values. More... | |
QuantLib::ext::shared_ptr< SimmConcentration > | simmConcentration_ |
Used to get the concentration thresholds for a given risk type and qualifier. More... | |
std::map< CrifRecord::RiskType, std::vector< std::string > > | mapBuckets_ |
std::map< CrifRecord::RiskType, std::vector< std::string > > | mapLabels_1_ |
std::map< CrifRecord::RiskType, std::vector< std::string > > | mapLabels_2_ |
std::map< CrifRecord::RiskType, QuantLib::Real > | rwRiskType_ |
std::map< CrifRecord::RiskType, Amounts > | rwBucket_ |
std::map< CrifRecord::RiskType, Amounts > | rwLabel_1_ |
std::map< CrifRecord::RiskType, std::vector< QuantLib::Real > > | curvatureWeights_ |
std::map< CrifRecord::RiskType, QuantLib::Real > | historicalVolatilityRatios_ |
Map from risk type to a historical volatility ratio. More... | |
std::set< CrifRecord::RiskType > | validRiskTypes_ |
Set of valid risk types for the current configuration. More... | |
Amounts | riskClassCorrelation_ |
Risk class correlation matrix. More... | |
std::map< CrifRecord::RiskType, Amounts > | interBucketCorrelation_ |
std::map< CrifRecord::RiskType, Amounts > | intraBucketCorrelation_ |
QuantLib::Size | mporDays_ |
Single Correlations | |
Single correlation numbers that don't fit in to a structure. They can be populated in derived classes and are requested in the base implementation of the correlation method. | |
QuantLib::Real | xccyCorr_ |
QuantLib::Real | infCorr_ |
Correlation between any yield and inflation in same currency. More... | |
QuantLib::Real | infVolCorr_ |
Correlation between any yield volatility and inflation volatility in same currency. More... | |
QuantLib::Real | irSubCurveCorr_ |
IR Label2 level i.e. sub-curve correlation. More... | |
QuantLib::Real | irInterCurrencyCorr_ |
IR correlation across currencies. More... | |
QuantLib::Real | crqResidualIntraCorr_ |
Credit-Q residual intra correlation. More... | |
QuantLib::Real | crqSameIntraCorr_ |
Credit-Q non-residual intra correlation when same qualifier but different vertex/source. More... | |
QuantLib::Real | crqDiffIntraCorr_ |
Credit-Q non-residual intra correlation when different qualifier. More... | |
QuantLib::Real | crnqResidualIntraCorr_ |
Credit-NonQ residual intra correlation. More... | |
QuantLib::Real | crnqSameIntraCorr_ |
Credit-NonQ non-residual intra correlation when same underlying names. More... | |
QuantLib::Real | crnqDiffIntraCorr_ |
Credit-NonQ non-residual intra correlation when different underlying names. More... | |
QuantLib::Real | crnqInterCorr_ |
Credit-NonQ non-residual inter bucket correlation. More... | |
QuantLib::Real | fxCorr_ |
FX correlation. More... | |
QuantLib::Real | basecorrCorr_ |
Base correlation risk factor correlation. More... | |
Private Member Functions | |
QuantLib::Real | sigmaMultiplier () const |
Calculate variable for use in sigma method. More... | |
Private Attributes | |
std::string | name_ |
Name of the SIMM configuration. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from SimmConfiguration | |
static std::set< RiskClass > | riskClasses (bool includeAll=false) |
Give back a set containing the RiskClass values optionally excluding 'All'. More... | |
static std::set< CrifRecord::RiskType > | riskTypes (bool includeAll=false) |
Give back a set containing the RiskType values optionally excluding 'All'. More... | |
static std::set< MarginType > | marginTypes (bool includeAll=false) |
Give back a set containing the MarginType values optionally excluding 'All'. More... | |
static std::set< CrifRecord::ProductClass > | productClasses (bool includeAll=false) |
Give back a set containing the ProductClass values optionally excluding 'All'. More... | |
static std::pair< CrifRecord::RiskType, CrifRecord::RiskType > | riskClassToRiskType (const RiskClass &rc) |
For a given risk class, return the corresponding risk types. More... | |
static RiskClass | riskTypeToRiskClass (const CrifRecord::RiskType &rt) |
For a given rirsk type, return the corresponding risk class. More... | |
static bool | less_than (const CrifRecord::ProductClass &lhs, const CrifRecord::ProductClass &rhs) |
Define ordering for ProductClass according to a waterfall: More... | |
static bool | greater_than (const CrifRecord::ProductClass &lhs, const CrifRecord::ProductClass &rhs) |
static bool | less_than_or_equal_to (const CrifRecord::ProductClass &lhs, const CrifRecord::ProductClass &rhs) |
static bool | greater_than_or_equal_to (const CrifRecord::ProductClass &lhs, const CrifRecord::ProductClass &rhs) |
static CrifRecord::ProductClass | maxProductClass (CrifRecord::ProductClass pc1, CrifRecord::ProductClass pc2) |
Return the "worse" ProductClass using a waterfall logic: More... | |
Static Protected Attributes inherited from SimmConfiguration | |
static const QuantLib::Size | numberOfRiskClasses = riskClassMap.size() |
Number of risk classes including RiskClass::All. More... | |
static const QuantLib::Size | numberOfMarginTypes = marginTypeMap.size() |
Number of margin types including MarginType::All. More... | |
static const QuantLib::Size | numberOfRegulations = regulationsMap.size() |
Number of regulations. More... | |
Definition at line 37 of file simmconfigurationbase.hpp.
typedef std::map<std::tuple<std::string, std::string, std::string>, QuantLib::Real> Amounts |
Definition at line 39 of file simmconfigurationbase.hpp.
|
protected |
Constructor taking the SIMM configuration name
and version
.
Definition at line 75 of file simmconfigurationbase.cpp.
|
overridevirtual |
Returns the SIMM configuration name.
Implements CrifConfiguration.
Definition at line 42 of file simmconfigurationbase.hpp.
|
overridevirtual |
Returns the SIMM configuration version.
Implements CrifConfiguration.
Definition at line 45 of file simmconfigurationbase.hpp.
|
overridevirtual |
Returns the SIMM bucket mapper used by the configuration.
Implements CrifConfiguration.
Definition at line 48 of file simmconfigurationbase.hpp.
|
overridevirtual |
Return true if the SIMM risk type rt
has buckets.
Implements SimmConfiguration.
Definition at line 79 of file simmconfigurationbase.cpp.
|
overridevirtual |
Return the SIMM bucket name for the given risk type rt
and qualifier
Implements CrifConfiguration.
Definition at line 81 of file simmconfigurationbase.cpp.
const bool checkValue | ( | const std::string & | value, |
const std::vector< std::string > & | container | ||
) | const |
Definition at line 86 of file simmconfigurationbase.cpp.
|
overridevirtual |
Return the SIMM bucket names for the given risk type rt
An empty vector is returned if the risk type has no buckets
Implements SimmConfiguration.
Definition at line 90 of file simmconfigurationbase.cpp.
|
overridevirtual |
Return the list of SIMM Label1 values for risk type rt
An empty vector is returned if the risk type does not use Label1
Implements SimmConfiguration.
Definition at line 96 of file simmconfigurationbase.cpp.
|
overridevirtual |
Return the list of SIMM Label2 values for risk type rt
An empty vector is returned if the risk type does not use Label2
Implements SimmConfiguration.
Definition at line 102 of file simmconfigurationbase.cpp.
|
overridevirtual |
Add SIMM Label2 values under certain circumstances.
Implements SimmConfiguration.
Reimplemented in SimmConfigurationCalibration, SimmConfiguration_ISDA_V1_3_38, SimmConfiguration_ISDA_V2_0, SimmConfiguration_ISDA_V2_1, SimmConfiguration_ISDA_V2_2, SimmConfiguration_ISDA_V2_3, SimmConfiguration_ISDA_V2_3_8, SimmConfiguration_ISDA_V2_5, SimmConfiguration_ISDA_V2_5A, and SimmConfiguration_ISDA_V2_6.
Definition at line 73 of file simmconfigurationbase.hpp.
|
overridevirtual |
Return the SIMM risk weight for the given risk type rt
with the given qualifier
and the given label_1
. Three possibilities:
rt
rt
and qualifier
Implements SimmConfiguration.
Reimplemented in SimmConfigurationCalibration, SimmConfiguration_ISDA_V2_2, SimmConfiguration_ISDA_V2_3, SimmConfiguration_ISDA_V2_3_8, SimmConfiguration_ISDA_V2_5, SimmConfiguration_ISDA_V2_5A, and SimmConfiguration_ISDA_V2_6.
Definition at line 108 of file simmconfigurationbase.cpp.
|
overridevirtual |
Gives back the value of the scaling function used in the calculation of curvature risk for the risk type rt
with SIMM Label1 value label_1
. The scaling function is:
\[ SF(t) = 0.5 \times \min \left(1, \frac{14}{t} \right) \]
where \(t\) is given in days.
rt
Implements SimmConfiguration.
Definition at line 153 of file simmconfigurationbase.cpp.
|
overridevirtual |
Give back the SIMM historical volatility ratio for the risk type rt
rt
Implements SimmConfiguration.
Definition at line 166 of file simmconfigurationbase.cpp.
|
overridevirtual |
Give back the value of \(\sigma_{kj}\) from the SIMM docs for risk type rt
. In general, rt
is a volatility risk type and the method returns:
\[ \sigma_{kj} = \frac{RW_k \sqrt{\frac{365}{14}}}{\Phi^{-1}(0.99)} \]
where \(RW_k\) is the corresponding delta risk weight and \(\Phi(z)\) is the cumulative standard normal distribution.
rt
Implements SimmConfiguration.
Definition at line 177 of file simmconfigurationbase.cpp.
|
overridevirtual |
Give back the scaling factor for the Interest Rate curvature margin
Implements SimmConfiguration.
Reimplemented in SimmConfigurationCalibration, SimmConfiguration_ISDA_V2_1, SimmConfiguration_ISDA_V2_2, SimmConfiguration_ISDA_V2_3, SimmConfiguration_ISDA_V2_3_8, SimmConfiguration_ISDA_V2_5, SimmConfiguration_ISDA_V2_5A, and SimmConfiguration_ISDA_V2_6.
Definition at line 120 of file simmconfigurationbase.hpp.
|
overridevirtual |
Give back the SIMM concentration threshold for the risk type rt
and the SIMM qualifier
Implements SimmConfiguration.
Definition at line 125 of file simmconfigurationbase.hpp.
|
overridevirtual |
Return true if rt
is a valid SIMM RiskType under the current configuration. Otherwise, return false.
Implements SimmConfiguration.
Definition at line 132 of file simmconfigurationbase.hpp.
|
overridevirtual |
Return the correlation between SIMM risk classes rc_1
and rc_2
.
Implements SimmConfiguration.
Definition at line 442 of file simmconfigurationbase.cpp.
|
overridevirtual |
Return the correlation between the firstQualifier
with risk type firstRt
, Label1 value of firstLabel_1
and Label2 value of firstLabel_2
and the secondQualifier
with risk type secondRt
, Label1 value of secondLabel_1
and Label2 value of secondLabel_2
firstLabel_1
and secondLabel_1
, just enter an empty string for both. Similarly for firstLabel_2
and secondLabel_2
.Implements SimmConfiguration.
Reimplemented in SimmConfigurationCalibration, SimmConfiguration_ISDA_V2_2, SimmConfiguration_ISDA_V2_3, SimmConfiguration_ISDA_V2_3_8, SimmConfiguration_ISDA_V2_5, SimmConfiguration_ISDA_V2_5A, and SimmConfiguration_ISDA_V2_6.
Definition at line 216 of file simmconfigurationbase.cpp.
QuantLib::Size mporDays | ( | ) | const |
MPOR in days.
Definition at line 156 of file simmconfigurationbase.hpp.
|
private |
Calculate variable for use in sigma method.
Definition at line 431 of file simmconfigurationbase.cpp.
|
protected |
Definition at line 70 of file simmconfigurationbase.cpp.
|
protected |
Helper method to find the index of the label
in labels
.
Definition at line 455 of file simmconfigurationbase.cpp.
|
protected |
A base implementation of addLabels2 that can be shared by derived classes.
Definition at line 462 of file simmconfigurationbase.cpp.
|
private |
Name of the SIMM configuration.
Definition at line 160 of file simmconfigurationbase.hpp.
|
protected |
SIMM configuration version.
Definition at line 170 of file simmconfigurationbase.hpp.
|
protected |
Used to map SIMM Qualifier names to SIMM bucket values.
Definition at line 173 of file simmconfigurationbase.hpp.
|
protected |
Used to get the concentration thresholds for a given risk type and qualifier.
Definition at line 176 of file simmconfigurationbase.hpp.
|
protected |
Map giving the SIMM bucket names for each risk type. If risk type is not present in the map keys => there are no buckets for that risk type
Definition at line 190 of file simmconfigurationbase.hpp.
|
protected |
Map giving the possible SIMM Label1 values for each risk type. If risk type is not present in the map keys then the Label1 value is not used for that risk type
Definition at line 196 of file simmconfigurationbase.hpp.
|
protected |
Map giving the possible SIMM Label2 values for each risk type. If risk type is not present in the map keys then the Label2 value is not used for that risk type
Definition at line 202 of file simmconfigurationbase.hpp.
|
protected |
Risk weights, there are three types:
Definition at line 209 of file simmconfigurationbase.hpp.
|
protected |
Definition at line 210 of file simmconfigurationbase.hpp.
|
protected |
Definition at line 211 of file simmconfigurationbase.hpp.
|
protected |
Map from risk type to a vector of curvature weights. The size of the vector of weights for a given risk type must equal the size of the vector of Label1 values for that risk type in the map mapLabels_1_
Definition at line 217 of file simmconfigurationbase.hpp.
|
protected |
Map from risk type to a historical volatility ratio.
Definition at line 220 of file simmconfigurationbase.hpp.
|
protected |
Set of valid risk types for the current configuration.
Definition at line 223 of file simmconfigurationbase.hpp.
|
protected |
Risk class correlation matrix.
Definition at line 226 of file simmconfigurationbase.hpp.
|
protected |
Map from risk type to a matrix of inter-bucket correlations for that risk type i.e. correlation between qualifiers of the risk type that fall in different buckets
Definition at line 232 of file simmconfigurationbase.hpp.
|
protected |
Map from risk type to an intra-bucket correlation for that risk type i.e. correlation between qualifiers of the risk type that fall in the same bucket
Definition at line 238 of file simmconfigurationbase.hpp.
|
protected |
Correlation between xccy basis and any yield or inflation in same currency
Definition at line 247 of file simmconfigurationbase.hpp.
|
protected |
Correlation between any yield and inflation in same currency.
Definition at line 249 of file simmconfigurationbase.hpp.
|
protected |
Correlation between any yield volatility and inflation volatility in same currency.
Definition at line 251 of file simmconfigurationbase.hpp.
|
protected |
IR Label2 level i.e. sub-curve correlation.
Definition at line 253 of file simmconfigurationbase.hpp.
|
protected |
IR correlation across currencies.
Definition at line 255 of file simmconfigurationbase.hpp.
|
protected |
Credit-Q residual intra correlation.
Definition at line 257 of file simmconfigurationbase.hpp.
|
protected |
Credit-Q non-residual intra correlation when same qualifier but different vertex/source.
Definition at line 259 of file simmconfigurationbase.hpp.
|
protected |
Credit-Q non-residual intra correlation when different qualifier.
Definition at line 261 of file simmconfigurationbase.hpp.
|
protected |
Credit-NonQ residual intra correlation.
Definition at line 263 of file simmconfigurationbase.hpp.
|
protected |
Credit-NonQ non-residual intra correlation when same underlying names.
Definition at line 265 of file simmconfigurationbase.hpp.
|
protected |
Credit-NonQ non-residual intra correlation when different underlying names.
Definition at line 267 of file simmconfigurationbase.hpp.
|
protected |
Credit-NonQ non-residual inter bucket correlation.
Definition at line 269 of file simmconfigurationbase.hpp.
|
protected |
FX correlation.
Definition at line 271 of file simmconfigurationbase.hpp.
|
protected |
Base correlation risk factor correlation.
Definition at line 273 of file simmconfigurationbase.hpp.
|
protected |
Margin Period of risk in days
Definition at line 276 of file simmconfigurationbase.hpp.