Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
CSA Class Reference

#include <ored/portfolio/nettingsetdefinition.hpp>

+ Collaboration diagram for CSA:

Public Types

enum  Type { Bilateral , CallOnly , PostOnly }
 

Public Member Functions

 CSA (const Type &type, const string &csaCurrency, const string &index, const Real &thresholdPay, const Real &thresholdRcv, const Real &mtaPay, const Real &mtaRcv, const Real &iaHeld, const string &iaType, const Period &marginCallFreq, const Period &marginPostFreq, const Period &mpr, const Real &collatSpreadPay, const Real &collatSpreadRcv, const vector< string > &eligCollatCcys, bool applyInitialMargin, Type initialMarginType, const bool calculateIMAmount, const bool calculateVMAmount, const string &nonExemptIMRegulations)
 
const Typetype () const
 Inspectors. More...
 
const string & csaCurrency () const
 
const string & index () const
 
Real thresholdPay () const
 
Real thresholdRcv () const
 
Real mtaPay () const
 
Real mtaRcv () const
 
Real independentAmountHeld () const
 
const string & independentAmountType () const
 
const Period & marginCallFrequency () const
 
const Period & marginPostFrequency () const
 
const Period & marginPeriodOfRisk () const
 
Real collatSpreadRcv () const
 
Real collatSpreadPay () const
 
vector< string > eligCollatCcys () const
 
bool applyInitialMargin ()
 
Type initialMarginType ()
 
bool calculateIMAmount ()
 
bool calculateVMAmount ()
 
const string & nonExemptIMRegulations ()
 
void invertCSA ()
 
void validate ()
 

Private Attributes

Type type_
 
string csaCurrency_
 
string index_
 
Real thresholdPay_
 
Real thresholdRcv_
 
Real mtaPay_
 
Real mtaRcv_
 
Real iaHeld_
 
string iaType_
 
Period marginCallFreq_
 
Period marginPostFreq_
 
Period mpr_
 
Real collatSpreadPay_
 
Real collatSpreadRcv_
 
vector< string > eligCollatCcys_
 
bool applyInitialMargin_
 
Type initialMarginType_
 
bool calculateIMAmount_
 
bool calculateVMAmount_
 
string nonExemptIMRegulations_
 

Detailed Description

Definition at line 38 of file nettingsetdefinition.hpp.

Member Enumeration Documentation

◆ Type

enum Type

Enumeration 'Type' specifies what type of collateral agreement is in place.

  • 'Bilateral' => both sides can request collateral margins
  • 'PostOnly' => only the counterparty is allowed to issue a call for additional collateral
  • 'CallOnly' => only WE are allowed to issue a margin call for additional collateral
Enumerator
Bilateral 
CallOnly 
PostOnly 

Definition at line 47 of file nettingsetdefinition.hpp.

Constructor & Destructor Documentation

◆ CSA()

CSA ( const Type type,
const string &  csaCurrency,
const string &  index,
const Real &  thresholdPay,
const Real &  thresholdRcv,
const Real &  mtaPay,
const Real &  mtaRcv,
const Real &  iaHeld,
const string &  iaType,
const Period &  marginCallFreq,
const Period &  marginPostFreq,
const Period &  mpr,
const Real &  collatSpreadPay,
const Real &  collatSpreadRcv,
const vector< string > &  eligCollatCcys,
bool  applyInitialMargin,
Type  initialMarginType,
const bool  calculateIMAmount,
const bool  calculateVMAmount,
const string &  nonExemptIMRegulations 
)

Definition at line 49 of file nettingsetdefinition.hpp.

59 marginCallFreq_(marginCallFreq), marginPostFreq_(marginPostFreq), mpr_(mpr),
const Type & type() const
Inspectors.
Real thresholdPay() const
const string & csaCurrency() const
const string & index() const
Real collatSpreadPay() const
vector< string > eligCollatCcys() const
Real collatSpreadRcv() const
const string & nonExemptIMRegulations()
vector< string > eligCollatCcys_
Real thresholdRcv() const

Member Function Documentation

◆ type()

const Type & type ( ) const

Inspectors.

Nature of CSA margining agreement (e.g. Bilateral, PostOnly, CallOnly)

Definition at line 68 of file nettingsetdefinition.hpp.

68{ return type_; }

◆ csaCurrency()

const string & csaCurrency ( ) const

Master Currency of CSA

Definition at line 70 of file nettingsetdefinition.hpp.

70{ return csaCurrency_; }

◆ index()

const string & index ( ) const

Index that determines the compounding rate

Definition at line 72 of file nettingsetdefinition.hpp.

72{ return index_; }

◆ thresholdPay()

Real thresholdPay ( ) const

Threshold amount for margin calls issued by counterparty

Definition at line 74 of file nettingsetdefinition.hpp.

74{ return thresholdPay_; }

◆ thresholdRcv()

Real thresholdRcv ( ) const

Threshold amount when issuing calls to counterparty

Definition at line 76 of file nettingsetdefinition.hpp.

76{ return thresholdRcv_; }

◆ mtaPay()

Real mtaPay ( ) const

Minimum Transfer Amount when posting collateral to counterparty

Definition at line 78 of file nettingsetdefinition.hpp.

78{ return mtaPay_; }

◆ mtaRcv()

Real mtaRcv ( ) const

Minimum Transfer Amount when receiving collateral from counterparty

Definition at line 80 of file nettingsetdefinition.hpp.

80{ return mtaRcv_; }

◆ independentAmountHeld()

Real independentAmountHeld ( ) const

Sum of Independent Amounts covered by the CSA (positive => we hold the amount)

Definition at line 82 of file nettingsetdefinition.hpp.

82{ return iaHeld_; }

◆ independentAmountType()

const string & independentAmountType ( ) const

'Type' of Independent Amount as specified in the CSA

Definition at line 84 of file nettingsetdefinition.hpp.

84{ return iaType_; }

◆ marginCallFrequency()

const Period & marginCallFrequency ( ) const

Margining Frequency when requesting collateral from counterparty (e.g. "1D", "1W")

Definition at line 86 of file nettingsetdefinition.hpp.

86{ return marginCallFreq_; }

◆ marginPostFrequency()

const Period & marginPostFrequency ( ) const

Margining Frequency when counterparty is requesting collateral (e.g. "1D", "1W")

Definition at line 88 of file nettingsetdefinition.hpp.

88{ return marginPostFreq_; }

◆ marginPeriodOfRisk()

const Period & marginPeriodOfRisk ( ) const

Margin Period of Risk (e.g. "1M")

Definition at line 90 of file nettingsetdefinition.hpp.

90{ return mpr_; }

◆ collatSpreadRcv()

Real collatSpreadRcv ( ) const

Spread for interest accrual on held collateral

Definition at line 92 of file nettingsetdefinition.hpp.

92{ return collatSpreadRcv_; }

◆ collatSpreadPay()

Real collatSpreadPay ( ) const

Spread for interest accrual on posted collateral

Definition at line 94 of file nettingsetdefinition.hpp.

94{ return collatSpreadPay_; }

◆ eligCollatCcys()

vector< string > eligCollatCcys ( ) const

Eligible Collateral Currencies

Definition at line 96 of file nettingsetdefinition.hpp.

96{ return eligCollatCcys_; }

◆ applyInitialMargin()

bool applyInitialMargin ( )

Apply (dynamic) initial margin in addition to variation margin

Definition at line 98 of file nettingsetdefinition.hpp.

98{ return applyInitialMargin_; }

◆ initialMarginType()

Type initialMarginType ( )

Direction of (dynamic) initial margin

Definition at line 100 of file nettingsetdefinition.hpp.

100{ return initialMarginType_; }

◆ calculateIMAmount()

bool calculateIMAmount ( )

Calculate SIMM as IM (currently used only for SA-CCR)

Definition at line 103 of file nettingsetdefinition.hpp.

103{ return calculateIMAmount_; }

◆ calculateVMAmount()

bool calculateVMAmount ( )

Calculate VM from NPV (currently used only for SA-CCR)

Definition at line 105 of file nettingsetdefinition.hpp.

105{ return calculateVMAmount_; }

◆ nonExemptIMRegulations()

const string & nonExemptIMRegulations ( )

IM regulations (whose trade sensitivities are usually exempt from margin/sensi calc) that we wish to include (currently used only for SA-CCR)

Definition at line 108 of file nettingsetdefinition.hpp.

108{ return nonExemptIMRegulations_; }

◆ invertCSA()

void invertCSA ( )

invert all relevant aspects of the CSA

Definition at line 54 of file nettingsetdefinition.cpp.

54 {
55 if (type_ != Bilateral) {
57 }
60 }
62 std::swap(thresholdPay_, thresholdRcv_);
63 std::swap(mtaPay_, mtaRcv_);
64 iaHeld_ *= -1;
66}

◆ validate()

void validate ( )

Definition at line 68 of file nettingsetdefinition.cpp.

68 {
69 QL_REQUIRE(csaCurrency_.size() == 3, "NettingSetDefinition build error;"
70 << " CSA currency should be a three-letter ISO code");
71
72 QL_REQUIRE(thresholdPay_ >= 0, "NettingSetDefinition build error; negative thresholdPay");
73 QL_REQUIRE(thresholdRcv_ >= 0, "NettingSetDefinition build error; negative thresholdRcv");
74 QL_REQUIRE(mtaPay_ >= 0, "NettingSetDefinition build error; negative mtaPay");
75 QL_REQUIRE(mtaRcv_ >= 0, "NettingSetDefinition build error; negative mtaRcv");
76 QL_REQUIRE(iaType_ == "FIXED", "NettingSetDefinition build error;"
77 << " unsupported independent amount type; " << iaType_);
78
79 QL_REQUIRE(marginCallFreq_ > Period(0, Days) && marginPostFreq_ > Period(0, Days),
80 "NettingSetDefinition build error;"
81 << " non-positive margining frequency");
82 QL_REQUIRE(mpr_ >= Period(0, Days), "NettingSetDefinition build error;"
83 << " negative margin period of risk");
85 LOG("NettingSetDefinition has CSA margining frequency ("
86 << marginCallFreq_ << ", " << marginPostFreq_ << ") longer than assumed margin period of risk " << mpr_);
87 }
88
89 for (Size i = 0; i < eligCollatCcys_.size(); i++) {
90 QL_REQUIRE(eligCollatCcys_[i].size() == 3,
91 "NettingSetDefinition build error;"
92 << "EligibleCollaterals currency should be a three-letter ISO code");
93 }
94
95 // unilateral CSA - set threshold near infinity to disable margining
96 switch (type_) {
97 case CallOnly: {
98 thresholdPay_ = std::numeric_limits<double>::max();
99 break;
100 }
101 case PostOnly: {
102 thresholdRcv_ = std::numeric_limits<double>::max();
103 }
104 default:
105 break;
106 }
107}
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
Size size(const ValueType &v)
Definition: value.cpp:145
+ Here is the call graph for this function:

Member Data Documentation

◆ type_

Type type_
private

Definition at line 115 of file nettingsetdefinition.hpp.

◆ csaCurrency_

string csaCurrency_
private

Definition at line 116 of file nettingsetdefinition.hpp.

◆ index_

string index_
private

Definition at line 117 of file nettingsetdefinition.hpp.

◆ thresholdPay_

Real thresholdPay_
private

Definition at line 118 of file nettingsetdefinition.hpp.

◆ thresholdRcv_

Real thresholdRcv_
private

Definition at line 119 of file nettingsetdefinition.hpp.

◆ mtaPay_

Real mtaPay_
private

Definition at line 120 of file nettingsetdefinition.hpp.

◆ mtaRcv_

Real mtaRcv_
private

Definition at line 121 of file nettingsetdefinition.hpp.

◆ iaHeld_

Real iaHeld_
private

Definition at line 122 of file nettingsetdefinition.hpp.

◆ iaType_

string iaType_
private

Definition at line 123 of file nettingsetdefinition.hpp.

◆ marginCallFreq_

Period marginCallFreq_
private

Definition at line 124 of file nettingsetdefinition.hpp.

◆ marginPostFreq_

Period marginPostFreq_
private

Definition at line 125 of file nettingsetdefinition.hpp.

◆ mpr_

Period mpr_
private

Definition at line 126 of file nettingsetdefinition.hpp.

◆ collatSpreadPay_

Real collatSpreadPay_
private

Definition at line 127 of file nettingsetdefinition.hpp.

◆ collatSpreadRcv_

Real collatSpreadRcv_
private

Definition at line 128 of file nettingsetdefinition.hpp.

◆ eligCollatCcys_

vector<string> eligCollatCcys_
private

Definition at line 129 of file nettingsetdefinition.hpp.

◆ applyInitialMargin_

bool applyInitialMargin_
private

Definition at line 130 of file nettingsetdefinition.hpp.

◆ initialMarginType_

Type initialMarginType_
private

Definition at line 131 of file nettingsetdefinition.hpp.

◆ calculateIMAmount_

bool calculateIMAmount_
private

Definition at line 132 of file nettingsetdefinition.hpp.

◆ calculateVMAmount_

bool calculateVMAmount_
private

Definition at line 132 of file nettingsetdefinition.hpp.

◆ nonExemptIMRegulations_

string nonExemptIMRegulations_
private

Definition at line 133 of file nettingsetdefinition.hpp.