Logo
Reference manual - version orea_version
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SimmConfigurationBase Class Reference
+ Inheritance diagram for SimmConfigurationBase:

Public Member Functions

const std::string & name () const override
 Returns the SIMM configuration name.
 
const std::string & version () const override
 Returns the SIMM configuration version.
 
const boost::shared_ptr< SimmBucketMapper > & bucketMapper () const override
 Returns the SIMM bucket mapper used by the configuration.
 
bool hasBuckets (const RiskType &rt) const override
 Return true if the SIMM risk type rt has buckets.
 
std::string bucket (const RiskType &rt, const std::string &qualifier) const override
 
std::vector< std::string > buckets (const RiskType &rt) const override
 
std::vector< std::string > labels1 (const RiskType &rt) const override
 
std::vector< std::string > labels2 (const RiskType &rt) const override
 
std::string labels2 (const boost::shared_ptr< QuantLib::InterestRateIndex > &irIndex) const override
 Return the SIMM Label2 value for the given interest rate index.
 
std::string labels2 (const QuantLib::Period &p) const override
 Return the SIMM Label2 value for the given Libor tenor.
 
void addLabels2 (const RiskType &rt, const std::string &label_2) override
 Add SIMM Label2 values under certain circumstances.
 
QuantLib::Real weight (const 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 RiskType &rt, const std::string &label_1) const override
 
QuantLib::Real historicalVolatilityRatio (const RiskType &rt) const override
 
QuantLib::Real sigma (const 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 RiskType &rt, const std::string &qualifier) const override
 
bool isValidRiskType (const 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.
 
QuantLib::Real correlation (const RiskType &firstRt, const std::string &firstQualifier, const std::string &firstLabel_1, const std::string &firstLabel_2, const 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.
 

Protected Member Functions

 SimmConfigurationBase (const boost::shared_ptr< SimmBucketMapper > &simmBucketMapper, const std::string &name, const std::string version, QuantLib::Size mporDays=10)
 Constructor taking the SIMM configuration name and version.
 
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.
 
void addLabels2Impl (const RiskType &rt, const std::string &label_2)
 A base implementation of addLabels2 that can be shared by derived classes.
 

Protected Attributes

boost::shared_ptr< SimmBucketMappersimmBucketMapper_
 Used to map SIMM Qualifier names to SIMM bucket values.
 
boost::shared_ptr< SimmConcentrationsimmConcentration_
 Used to get the concentration thresholds for a given risk type and qualifier.
 
std::map< RiskType, std::vector< std::string > > mapBuckets_
 
std::map< RiskType, std::vector< std::string > > mapLabels_1_
 
std::map< RiskType, std::vector< std::string > > mapLabels_2_
 
std::map< RiskType, QuantLib::Real > rwRiskType_
 
std::map< RiskType, std::vector< QuantLib::Real > > rwBucket_
 
std::map< std::pair< RiskType, std::string >, std::vector< QuantLib::Real > > rwLabel_1_
 
std::map< RiskType, std::vector< QuantLib::Real > > curvatureWeights_
 
std::map< RiskType, QuantLib::Real > historicalVolatilityRatios_
 Map from risk type to a historical volatility ratio.
 
std::set< RiskTypevalidRiskTypes_
 Set of valid risk types for the current configuration.
 
QuantLib::Matrix riskClassCorrelation_
 Risk class correlation matrix.
 
QuantLib::Matrix irTenorCorrelation_
 Correlation matrix giving correlation between interest rate tenors.
 
std::map< RiskType, QuantLib::Matrix > interBucketCorrelation_
 
std::map< RiskType, std::vector< QuantLib::Real > > 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.
 
QuantLib::Real infVolCorr_
 Correlation between any yield volatility and inflation volatility in same currency.
 
QuantLib::Real irSubCurveCorr_
 IR Label2 level i.e. sub-curve correlation.
 
QuantLib::Real irInterCurrencyCorr_
 IR correlation across currencies.
 
QuantLib::Real crqResidualIntraCorr_
 Credit-Q residual intra correlation.
 
QuantLib::Real crqSameIntraCorr_
 Credit-Q non-residual intra correlation when same qualifier but different vertex/source.
 
QuantLib::Real crqDiffIntraCorr_
 Credit-Q non-residual intra correlation when different qualifier.
 
QuantLib::Real crnqResidualIntraCorr_
 Credit-NonQ residual intra correlation.
 
QuantLib::Real crnqSameIntraCorr_
 Credit-NonQ non-residual intra correlation when same underlying names.
 
QuantLib::Real crnqDiffIntraCorr_
 Credit-NonQ non-residual intra correlation when different underlying names.
 
QuantLib::Real crnqInterCorr_
 Credit-NonQ non-residual inter bucket correlation.
 
QuantLib::Real fxCorr_
 FX correlation.
 
QuantLib::Real basecorrCorr_
 Base correlation risk factor correlation.
 

Additional Inherited Members

- Public Types inherited from SimmConfiguration
enum class  SimmSide { Call , Post }
 Enum indicating the relevant side of the SIMM calculation.
 
enum class  RiskClass {
  InterestRate , CreditQualifying , CreditNonQualifying , Equity ,
  Commodity , FX , All
}
 
enum class  RiskType {
  Commodity , CommodityVol , CreditNonQ , CreditQ ,
  CreditVol , CreditVolNonQ , Equity , EquityVol ,
  FX , FXVol , Inflation , IRCurve ,
  IRVol , InflationVol , BaseCorr , XCcyBasis ,
  ProductClassMultiplier , AddOnNotionalFactor , Notional , AddOnFixedAmount ,
  PV , All
}
 
enum class  MarginType {
  Delta , Vega , Curvature , BaseCorr ,
  AdditionalIM , All
}
 
enum class  ProductClass {
  RatesFX , Rates , FX , Credit ,
  Equity , Commodity , Empty , Other ,
  AddOnNotionalFactor , AddOnFixedAmount , 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.
 
- Static Public Member Functions inherited from SimmConfiguration
static std::set< RiskClassriskClasses (bool includeAll=false)
 Give back a set containing the RiskClass values optionally excluding 'All'.
 
static std::set< RiskTyperiskTypes (bool includeAll=false)
 Give back a set containing the RiskType values optionally excluding 'All'.
 
static std::set< MarginTypemarginTypes (bool includeAll=false)
 Give back a set containing the MarginType values optionally excluding 'All'.
 
static std::set< ProductClassproductClasses (bool includeAll=false)
 Give back a set containing the ProductClass values optionally excluding 'All'.
 
static bool less_than (const ProductClass &lhs, const ProductClass &rhs)
 Define ordering for ProductClass according to a waterfall:
 
static bool greater_than (const ProductClass &lhs, const ProductClass &rhs)
 
static bool less_than_or_equal_to (const ProductClass &lhs, const ProductClass &rhs)
 
static bool greater_than_or_equal_to (const ProductClass &lhs, const ProductClass &rhs)
 
static ProductClass maxProductClass (ProductClass pc1, ProductClass pc2)
 Return the "worse" ProductClass using a waterfall logic:
 
- Static Protected Attributes inherited from SimmConfiguration
static const QuantLib::Size numberOfRiskClasses
 Number of risk classes including RiskClass::All.
 
static const QuantLib::Size numberOfRiskTypes
 Number of risk types including RiskType::All.
 
static const QuantLib::Size numberOfMarginTypes
 Number of margin types including MarginType::All.
 
static const QuantLib::Size numberOfProductClasses
 Number of product classes including ProductClass::All.
 
static const QuantLib::Size numberOfRegulations
 Number of regulations.
 

Member Function Documentation

◆ bucket()

std::string bucket ( const RiskType rt,
const std::string &  qualifier 
) const
overridevirtual

Return the SIMM bucket name for the given risk type rt and qualifier

Implements SimmConfiguration.

◆ buckets()

std::vector<std::string> buckets ( const RiskType rt) const
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.

◆ labels1()

std::vector<std::string> labels1 ( const RiskType rt) const
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.

◆ labels2()

std::vector<std::string> labels2 ( const RiskType rt) const
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.

◆ weight()

QuantLib::Real weight ( const RiskType rt,
boost::optional< std::string >  qualifier = boost::none,
boost::optional< std::string >  label_1 = boost::none,
const std::string &  calculationCurrency = "" 
) const
overridevirtual

Return the SIMM risk weight for the given risk type rt with the given qualifier and the given label_1. Three possibilities:

  1. there is a flat risk weight for the risk factor's RiskType so only need rt
  2. there is a qualifier-dependent risk weight for the risk factor's RiskType so need rt and qualifier
  3. there is a qualifier-dependent and label1-dependent risk weight for the risk factor's RiskType so need all three parameters

Implements SimmConfiguration.

Reimplemented in SimmConfiguration_ISDA_V2_6, SimmConfiguration_ISDA_V2_5A, SimmConfiguration_ISDA_V2_5, SimmConfiguration_ISDA_V2_3_8, SimmConfiguration_ISDA_V2_3, and SimmConfiguration_ISDA_V2_2.

◆ curvatureWeight()

QuantLib::Real curvatureWeight ( const RiskType rt,
const std::string &  label_1 
) const
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.

Warning:
An error is thrown if there is no curvature from the risk type rt

Implements SimmConfiguration.

◆ historicalVolatilityRatio()

QuantLib::Real historicalVolatilityRatio ( const RiskType rt) const
overridevirtual

Give back the SIMM historical volatility ratio for the risk type rt

Remarks
1.0 is returned if there is no historical volatility ratio for rt

Implements SimmConfiguration.

◆ sigma()

QuantLib::Real sigma ( const RiskType rt,
boost::optional< std::string >  qualifier = boost::none,
boost::optional< std::string >  label_1 = boost::none,
const std::string &  calculationCurrency = "" 
) const
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.

Remarks
For convenience, returns 1.0 if not applicable for risk type rt

Implements SimmConfiguration.

◆ curvatureMarginScaling()

QuantLib::Real curvatureMarginScaling ( ) const
overridevirtual

◆ concentrationThreshold()

QuantLib::Real concentrationThreshold ( const RiskType rt,
const std::string &  qualifier 
) const
overridevirtual

Give back the SIMM concentration threshold for the risk type rt and the SIMM qualifier

Implements SimmConfiguration.

◆ isValidRiskType()

bool isValidRiskType ( const RiskType rt) const
overridevirtual

Return true if rt is a valid SIMM RiskType under the current configuration. Otherwise, return false.

Implements SimmConfiguration.

◆ correlation()

QuantLib::Real correlation ( const RiskType firstRt,
const std::string &  firstQualifier,
const std::string &  firstLabel_1,
const std::string &  firstLabel_2,
const RiskType secondRt,
const std::string &  secondQualifier,
const std::string &  secondLabel_1,
const std::string &  secondLabel_2,
const std::string &  calculationCurrency = "" 
) const
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

Remarks
if not using firstLabel_1 and secondLabel_1, just enter an empty string for both. Similarly for firstLabel_2 and secondLabel_2.
Warning:
Returns 0 if no correlation found

Implements SimmConfiguration.

Reimplemented in SimmConfiguration_ISDA_V2_6, SimmConfiguration_ISDA_V2_5A, SimmConfiguration_ISDA_V2_5, SimmConfiguration_ISDA_V2_3_8, SimmConfiguration_ISDA_V2_3, and SimmConfiguration_ISDA_V2_2.

Member Data Documentation

◆ mapBuckets_

std::map<RiskType, std::vector<std::string> > mapBuckets_
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

◆ mapLabels_1_

std::map<RiskType, std::vector<std::string> > mapLabels_1_
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

◆ mapLabels_2_

std::map<RiskType, std::vector<std::string> > mapLabels_2_
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

◆ rwRiskType_

std::map<RiskType, QuantLib::Real> rwRiskType_
protected

Risk weights, there are three types:

  1. risk type dependent only
  2. risk type and bucket dependent
  3. risk type, bucket and label1 dependent

◆ curvatureWeights_

std::map<RiskType, std::vector<QuantLib::Real> > curvatureWeights_
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_

◆ interBucketCorrelation_

std::map<RiskType, QuantLib::Matrix> interBucketCorrelation_
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

◆ intraBucketCorrelation_

std::map<RiskType, std::vector<QuantLib::Real> > intraBucketCorrelation_
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

◆ xccyCorr_

QuantLib::Real xccyCorr_
protected

Correlation between xccy basis and any yield or inflation in same currency

◆ mporDays_

QuantLib::Size mporDays_
protected

Margin Period of risk in days