Skip to content

Commit 755e99b

Browse files
NathanielVolfangojenkins
authored andcommitted
QPR-12013 -- Handle new SIMM versions
1 parent 43df9d8 commit 755e99b

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

OREAnalytics/orea/simm/simmcalculator.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <orea/simm/crifloader.hpp>
2121
#include <orea/simm/simmcalculator.hpp>
2222
#include <orea/simm/utilities.hpp>
23+
#include <orea/simm/simmconfigurationbase.hpp>
2324

2425
#include <boost/math/distributions/normal.hpp>
2526
#include <numeric>
@@ -887,9 +888,9 @@ pair<map<string, Real>, bool> SimmCalculator::irCurvatureMargin(const NettingSet
887888
}
888889

889890
// Now deal with inflation component
890-
SimmVersion version = parseSimmVersion(simmConfiguration_->version());
891+
const string simmVersion = simmConfiguration_->version();
891892
SimmVersion thresholdVersion = SimmVersion::V1_0;
892-
if (version > thresholdVersion) {
893+
if (simmConfiguration_->isSimmConfigCalibration() || parseSimmVersion(simmVersion) > thresholdVersion) {
893894
// Weighted sensitivity i.e. $WS_{k,i}$ from SIMM docs
894895
Real infWs = 0.0;
895896
for (auto infIt = pInfQualifier.first; infIt != pInfQualifier.second; ++infIt) {
@@ -1206,9 +1207,10 @@ SimmCalculator::curvatureMargin(const NettingSetDetails& nettingSetDetails, cons
12061207
// example you use sfOuter * (itOuter->amountResultCcy * multiplier) * sigmaOuter;
12071208
Real wsOuter = sfOuter * ((itOuter->amountResultCcy * multiplier) * sigmaOuter);
12081209
// for ISDA SIMM 2.2 or higher, this $CVR_{ik}$ for EQ bucket 12 is zero
1209-
SimmVersion version = parseSimmVersion(simmConfiguration_->version());
1210+
const string simmVersion = simmConfiguration_->version();
12101211
SimmVersion thresholdVersion = SimmVersion::V2_2;
1211-
if (version >= thresholdVersion && bucket == "12" && rt == RiskType::EquityVol) {
1212+
if ((simmConfiguration_->isSimmConfigCalibration() || parseSimmVersion(simmVersion) >= thresholdVersion) &&
1213+
bucket == "12" && rt == RiskType::EquityVol) {
12121214
wsOuter = 0.0;
12131215
}
12141216
// Update weighted sensitivity sum

OREAnalytics/orea/simm/simmconfiguration.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ class SimmConfiguration {
294294
const std::string& secondLabel_1, const std::string& secondLabel_2,
295295
const std::string& calculationCurrency = "") const = 0;
296296

297+
virtual bool isSimmConfigCalibration() const { return false; }
298+
297299
protected:
298300
//! Number of risk classes including RiskClass::All
299301
static const QuantLib::Size numberOfRiskClasses;

OREAnalytics/orea/simm/simmconfigurationbase.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,8 @@ QuantLib::Real SimmConfigurationBase::correlation(const RiskType& firstRt, const
394394

395395
// Non-residual
396396
if (bucket_1 == bucket_2) {
397-
SimmVersion version = parseSimmVersion(version_);
398397
SimmVersion thresholdVersion = SimmVersion::V2_2;
399-
if (version >= thresholdVersion) {
398+
if (isSimmConfigCalibration() || parseSimmVersion(version_) >= thresholdVersion) {
400399
// In ISDA SIMM version 2.2 or greater, the CRNQ correlations differ depending on whether or not
401400
// the entities have the same group name i.e. CMBX.
402401
return firstLabel_2 == secondLabel_2 ? crnqSameIntraCorr_ : crnqDiffIntraCorr_;

OREAnalytics/orea/simm/simmconfigurationcalibration.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class SimmConfigurationCalibration : public SimmConfigurationBase {
5656
const RiskType& secondRt, const std::string& secondQualifier,
5757
const std::string& secondLabel_1, const std::string& secondLabel_2,
5858
const std::string& calculationCurrency = "") const override;
59+
60+
virtual bool isSimmConfigCalibration() const override { return true; }
5961

6062
private:
6163
//! Find the group of the \p qualifier

0 commit comments

Comments
 (0)