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

Exposure Aggregation and XVA Calculation. More...

#include <orea/aggregation/postprocess.hpp>

+ Collaboration diagram for PostProcess:

Public Member Functions

 PostProcess (const QuantLib::ext::shared_ptr< Portfolio > &portfolio, const QuantLib::ext::shared_ptr< NettingSetManager > &nettingSetManager, const QuantLib::ext::shared_ptr< CollateralBalances > &collateralBalances, const QuantLib::ext::shared_ptr< Market > &market, const std::string &configuration, const QuantLib::ext::shared_ptr< NPVCube > &cube, const QuantLib::ext::shared_ptr< AggregationScenarioData > &scenarioData, const map< string, bool > &analytics, const string &baseCurrency, const string &allocationMethod, Real cvaMarginalAllocationLimit, Real quantile=0.95, const string &calculationType="Symmetric", const string &dvaName="", const string &fvaBorrowingCurve="", const string &fvaLendingCurve="", const QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > &dimCalculator=QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator >(), const QuantLib::ext::shared_ptr< CubeInterpretation > &cubeInterpretation=QuantLib::ext::shared_ptr< CubeInterpretation >(), bool fullInitialCollateralisation=false, vector< Period > cvaSpreadSensiGrid={6 *Months, 1 *Years, 3 *Years, 5 *Years, 10 *Years}, Real cvaSpreadSensiShiftSize=0.0001, Real kvaCapitalDiscountRate=0.10, Real kvaAlpha=1.4, Real kvaRegAdjustment=12.5, Real kvaCapitalHurdle=0.012, Real kvaOurPdFloor=0.03, Real kvaTheirPdFloor=0.03, Real kvaOurCvaRiskWeight=0.05, Real kvaTheirCvaRiskWeight=0.05, const QuantLib::ext::shared_ptr< NPVCube > &cptyCube_=nullptr, const string &flipViewBorrowingCurvePostfix="_BORROW", const string &flipViewLendingCurvePostfix="_LEND", const QuantLib::ext::shared_ptr< CreditSimulationParameters > &creditSimulationParameters=nullptr, const std::vector< Real > &creditMigrationDistributionGrid={}, const std::vector< Size > &creditMigrationTimeSteps={}, const Matrix &creditStateCorrelationMatrix=Matrix(), bool withMporStickyDate=false, const MporCashFlowMode mporCashFlowMode=MporCashFlowMode::Unspecified)
 Constructor. More...
 
void setDimCalculator (QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > dimCalculator)
 
const vector< Real > & spreadSensitivityTimes ()
 
const vector< Period > & spreadSensitivityGrid ()
 
const std::map< string, Size > tradeIds ()
 Return list of Trade IDs in the portfolio. More...
 
const std::map< string, Size > nettingSetIds ()
 Return list of netting set IDs in the portfolio. More...
 
const map< string, string > & counterpartyId ()
 Return the map of counterparty Ids. More...
 
const vector< Real > & tradeEPE (const string &tradeId)
 Return trade level Expected Positive Exposure evolution. More...
 
const vector< Real > & tradeENE (const string &tradeId)
 Return trade level Expected Negative Exposure evolution. More...
 
const vector< Real > & tradeEE_B (const string &tradeId)
 Return trade level Basel Expected Exposure evolution. More...
 
const Real & tradeEPE_B (const string &tradeId)
 Return trade level Basel Expected Positive Exposure evolution. More...
 
const vector< Real > & tradeEEE_B (const string &tradeId)
 Return trade level Effective Expected Exposure evolution. More...
 
const Real & tradeEEPE_B (const string &tradeId)
 Return trade level Effective Expected Positive Exposure evolution. More...
 
const vector< Real > & tradePFE (const string &tradeId)
 Return trade level Potential Future Exposure evolution. More...
 
const vector< Real > & netEPE (const string &nettingSetId)
 Return Netting Set Expected Positive Exposure evolution. More...
 
const vector< Real > & netENE (const string &nettingSetId)
 Return Netting Set Expected Negative Exposure evolution. More...
 
const vector< Real > & netEE_B (const string &nettingSetId)
 Return Netting Set Basel Expected Exposure evolution. More...
 
const Real & netEPE_B (const string &nettingSetId)
 Return Netting Set Basel Expected Positive Exposure evolution. More...
 
const vector< Real > & netEEE_B (const string &nettingSetId)
 Return Netting Set Effective Expected Exposure evolution. More...
 
const Real & netEEPE_B (const string &nettingSetId)
 Return Netting Set Effective Expected Positive Exposure evolution. More...
 
const vector< Real > & netPFE (const string &nettingSetId)
 Return Netting Set Potential Future Exposure evolution. More...
 
const vector< Real > & expectedCollateral (const string &nettingSetId)
 Return the netting set's expected collateral evolution. More...
 
const vector< Real > & colvaIncrements (const string &nettingSetId)
 Return the netting set's expected COLVA increments through time. More...
 
const vector< Real > & collateralFloorIncrements (const string &nettingSetId)
 Return the netting set's expected Collateral Floor increments through time. More...
 
const vector< Real > & allocatedTradeEPE (const string &tradeId)
 Return the trade EPE, allocated down from the netting set level. More...
 
const vector< Real > & allocatedTradeENE (const string &tradeId)
 Return trade ENE, allocated down from the netting set level. More...
 
vector< Real > netCvaHazardRateSensitivity (const string &nettingSetId)
 Return Netting Set CVA Hazard Rate Sensitivity vector. More...
 
vector< Real > netCvaSpreadSensitivity (const string &nettingSetId)
 Return Netting Set CVA Spread Sensitivity vector. More...
 
const std::map< std::string, std::vector< QuantLib::Real > > & netCvaSpreadSensitivity () const
 Return Netting Set CVA Spread Sensitivity vector. More...
 
Real tradeCVA (const string &tradeId)
 Return trade (stand-alone) CVA. More...
 
Real tradeDVA (const string &tradeId)
 Return trade (stand-alone) DVA. More...
 
Real tradeMVA (const string &tradeId)
 Return trade (stand-alone) MVA. More...
 
Real tradeFBA (const string &tradeId)
 Return trade (stand-alone) FBA (Funding Benefit Adjustment) More...
 
Real tradeFCA (const string &tradeId)
 Return trade (stand-alone) FCA (Funding Cost Adjustment) More...
 
Real tradeFBA_exOwnSP (const string &tradeId)
 Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding own survival probability. More...
 
Real tradeFCA_exOwnSP (const string &tradeId)
 Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding own survival probability. More...
 
Real tradeFBA_exAllSP (const string &tradeId)
 Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding both survival probabilities. More...
 
Real tradeFCA_exAllSP (const string &tradeId)
 Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding both survival probabilities. More...
 
Real allocatedTradeCVA (const string &tradeId)
 Return allocated trade CVA (trade CVAs add up to netting set CVA) More...
 
Real allocatedTradeDVA (const string &tradeId)
 Return allocated trade DVA (trade DVAs add up to netting set DVA) More...
 
Real nettingSetCVA (const string &nettingSetId)
 Return netting set CVA. More...
 
Real nettingSetDVA (const string &nettingSetId)
 Return netting set DVA. More...
 
Real nettingSetMVA (const string &nettingSetId)
 Return netting set MVA. More...
 
Real nettingSetFBA (const string &nettingSetId)
 Return netting set FBA. More...
 
Real nettingSetFCA (const string &nettingSetId)
 Return netting set FCA. More...
 
Real nettingSetOurKVACCR (const string &nettingSetId)
 Return netting set KVA-CCR. More...
 
Real nettingSetTheirKVACCR (const string &nettingSetId)
 Return netting set KVA-CCR from counterparty perspective. More...
 
Real nettingSetOurKVACVA (const string &nettingSetId)
 Return netting set KVA-CVA. More...
 
Real nettingSetTheirKVACVA (const string &nettingSetId)
 Return netting set KVA-CVA from counterparty perspective. More...
 
Real nettingSetFBA_exOwnSP (const string &nettingSetId)
 Return netting set FBA excluding own survival probability. More...
 
Real nettingSetFCA_exOwnSP (const string &nettingSetId)
 Return netting set FCA excluding own survival probability. More...
 
Real nettingSetFBA_exAllSP (const string &nettingSetId)
 Return netting set FBA excluding both survival probabilities. More...
 
Real nettingSetFCA_exAllSP (const string &nettingSetId)
 Return netting set FCA excluding both survival probabilities. More...
 
Real nettingSetCOLVA (const string &nettingSetId)
 Return netting set COLVA. More...
 
Real nettingSetCollateralFloor (const string &nettingSetId)
 Return netting set Collateral Floor value. More...
 
const QuantLib::ext::shared_ptr< NPVCube > & cube ()
 Inspector for the input NPV cube (by trade, time, scenario) More...
 
const QuantLib::ext::shared_ptr< NPVCube > & cptyCube ()
 Inspector for the input Cpty cube (by name, time, scenario) More...
 
const QuantLib::ext::shared_ptr< NPVCube > & netCube ()
 Return the for the input NPV cube after netting and collateral (by netting set, time, scenario) More...
 
void exportDimEvolution (ore::data::Report &dimEvolutionReport)
 Return the dynamic initial margin cube (regression approach) More...
 
void exportDimRegression (const std::string &nettingSet, const std::vector< Size > &timeSteps, const std::vector< QuantLib::ext::shared_ptr< ore::data::Report > > &dimRegReports)
 Write DIM as a function of sample netting set NPV for a given time step. More...
 
QuantLib::Real cvaSpreadSensiShiftSize ()
 get the cvaSpreadSensiShiftSize More...
 
const std::vector< Real > & creditMigrationUpperBucketBounds () const
 get the credit migration pnl distributions for each time step More...
 
const std::vector< std::vector< Real > > & creditMigrationCdf () const
 
const std::vector< std::vector< Real > > & creditMigrationPdf () const
 

Protected Member Functions

QuantLib::ext::shared_ptr< vector< QuantLib::ext::shared_ptr< CollateralAccount > > > collateralPaths (const string &nettingSetId, const QuantLib::ext::shared_ptr< NettingSetManager > &nettingSetManager, const QuantLib::ext::shared_ptr< Market > &market, const std::string &configuration, const QuantLib::ext::shared_ptr< AggregationScenarioData > &scenarioData, Size dates, Size samples, const vector< vector< Real > > &nettingSetValue, Real nettingSetValueToday, const Date &nettingSetMaturity)
 Helper function to return the collateral account evolution for a given netting set. More...
 
void updateNettingSetKVA ()
 
void updateNettingSetCvaSensitivity ()
 

Protected Attributes

QuantLib::ext::shared_ptr< Portfolioportfolio_
 
QuantLib::ext::shared_ptr< NettingSetManagernettingSetManager_
 
QuantLib::ext::shared_ptr< CollateralBalancescollateralBalances_
 
QuantLib::ext::shared_ptr< Marketmarket_
 
const std::string configuration_
 
QuantLib::ext::shared_ptr< NPVCubecube_
 
QuantLib::ext::shared_ptr< NPVCubecptyCube_
 
QuantLib::ext::shared_ptr< AggregationScenarioDatascenarioData_
 
map< string, boolanalytics_
 
map< string, vector< Real > > tradeEPE_
 
map< string, vector< Real > > tradeENE_
 
map< string, vector< Real > > allocatedTradeEPE_
 
map< string, vector< Real > > allocatedTradeENE_
 
map< string, vector< Real > > netEPE_
 
map< string, vector< Real > > netENE_
 
map< string, Real > ourNettingSetKVACCR_
 
map< string, Real > theirNettingSetKVACCR_
 
map< string, Real > ourNettingSetKVACVA_
 
map< string, Real > theirNettingSetKVACVA_
 
map< string, vector< Real > > netCvaSpreadSensi_
 
map< string, vector< Real > > netCvaHazardRateSensi_
 
string baseCurrency_
 
Real quantile_
 
CollateralExposureHelper::CalculationType calcType_
 
string dvaName_
 
string fvaBorrowingCurve_
 
string fvaLendingCurve_
 
QuantLib::ext::shared_ptr< DynamicInitialMarginCalculatordimCalculator_
 
QuantLib::ext::shared_ptr< ExposureCalculatorexposureCalculator_
 
QuantLib::ext::shared_ptr< NettedExposureCalculatornettedExposureCalculator_
 
QuantLib::ext::shared_ptr< ValueAdjustmentCalculatorcvaCalculator_
 
QuantLib::ext::shared_ptr< ValueAdjustmentCalculatorallocatedCvaCalculator_
 
QuantLib::ext::shared_ptr< CubeInterpretationcubeInterpretation_
 
bool fullInitialCollateralisation_
 
vector< Period > cvaSpreadSensiGrid_
 
vector< Time > cvaSpreadSensiTimes_
 
Real cvaSpreadSensiShiftSize_
 
Real kvaCapitalDiscountRate_
 
Real kvaAlpha_
 
Real kvaRegAdjustment_
 
Real kvaCapitalHurdle_
 
Real kvaOurPdFloor_
 
Real kvaTheirPdFloor_
 
Real kvaOurCvaRiskWeight_
 
Real kvaTheirCvaRiskWeight_
 
QuantLib::ext::shared_ptr< CreditSimulationParameterscreditSimulationParameters_
 
std::vector< Real > creditMigrationDistributionGrid_
 
std::vector< Size > creditMigrationTimeSteps_
 
Matrix creditStateCorrelationMatrix_
 
QuantLib::ext::shared_ptr< CreditMigrationCalculatorcreditMigrationCalculator_
 
std::vector< Real > creditMigrationUpperBucketBounds_
 
std::vector< std::vector< Real > > creditMigrationCdf_
 
std::vector< std::vector< Real > > creditMigrationPdf_
 
bool withMporStickyDate_
 
MporCashFlowMode mporCashFlowMode_
 

Detailed Description

Exposure Aggregation and XVA Calculation.

This class aggregates NPV cube data, computes exposure statistics and various XVAs, all at trade and netting set level:

1) Exposures

2) Dynamic Initial Margin via regression

3) XVAs:

4) Allocation from netting set to trade level such that allocated contributions add up to the netting set

All analytics are precomputed when the class constructor is called. A number of inspectors described below then return the individual analytics results.

Note:

Definition at line 93 of file postprocess.hpp.

Constructor & Destructor Documentation

◆ PostProcess()

PostProcess ( const QuantLib::ext::shared_ptr< Portfolio > &  portfolio,
const QuantLib::ext::shared_ptr< NettingSetManager > &  nettingSetManager,
const QuantLib::ext::shared_ptr< CollateralBalances > &  collateralBalances,
const QuantLib::ext::shared_ptr< Market > &  market,
const std::string &  configuration,
const QuantLib::ext::shared_ptr< NPVCube > &  cube,
const QuantLib::ext::shared_ptr< AggregationScenarioData > &  scenarioData,
const map< string, bool > &  analytics,
const string &  baseCurrency,
const string &  allocationMethod,
Real  cvaMarginalAllocationLimit,
Real  quantile = 0.95,
const string &  calculationType = "Symmetric",
const string &  dvaName = "",
const string &  fvaBorrowingCurve = "",
const string &  fvaLendingCurve = "",
const QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > &  dimCalculator = QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator>(),
const QuantLib::ext::shared_ptr< CubeInterpretation > &  cubeInterpretation = QuantLib::ext::shared_ptr<CubeInterpretation>(),
bool  fullInitialCollateralisation = false,
vector< Period >  cvaSpreadSensiGrid = {6 * Months, 1 * Years, 3 * Years, 5 * Years, 10 * Years},
Real  cvaSpreadSensiShiftSize = 0.0001,
Real  kvaCapitalDiscountRate = 0.10,
Real  kvaAlpha = 1.4,
Real  kvaRegAdjustment = 12.5,
Real  kvaCapitalHurdle = 0.012,
Real  kvaOurPdFloor = 0.03,
Real  kvaTheirPdFloor = 0.03,
Real  kvaOurCvaRiskWeight = 0.05,
Real  kvaTheirCvaRiskWeight = 0.05,
const QuantLib::ext::shared_ptr< NPVCube > &  cptyCube_ = nullptr,
const string &  flipViewBorrowingCurvePostfix = "_BORROW",
const string &  flipViewLendingCurvePostfix = "_LEND",
const QuantLib::ext::shared_ptr< CreditSimulationParameters > &  creditSimulationParameters = nullptr,
const std::vector< Real > &  creditMigrationDistributionGrid = {},
const std::vector< Size > &  creditMigrationTimeSteps = {},
const Matrix &  creditStateCorrelationMatrix = Matrix(),
bool  withMporStickyDate = false,
const MporCashFlowMode  mporCashFlowMode = MporCashFlowMode::Unspecified 
)

Constructor.

Parameters
portfolioTrade portfolio to identify e.g. netting set, maturity, break dates for each trade
nettingSetManagerNetting set manager to access CSA details for each netting set
collateralBalancesCollateral balances (VM, IM, IA)
marketMarket data object to access e.g. discounting and funding curves
configurationMarket configuration to use
cubeInput NPV Cube
scenarioDataSubset of simulated market data, index fixings and FX spot rates, associated with the NPV cube
analyticsSelection of analytics to be produced
baseCurrencyExpression currency for all results
allocationMethodMethod to be used for Exposure/XVA allocation down to trade level
cvaMarginalAllocationLimitCutoff parameter for the marginal allocation method below which we switch to equal distribution
quantileQuantile for Potential Future Exposure output
calculationTypeCollateral calculation type to be used, see class CollateralExposureHelper
dvaNameCredit curve name to be used for "our" credit risk in DVA calculations
fvaBorrowingCurveBorrowing curve name to be used in FVA calculations
fvaLendingCurveLending curve name to be used in FVA calculations
dimCalculatorDynamic Initial Margin Calculator
cubeInterpretationInterpreter for cube storage (where to find which data items)
fullInitialCollateralisationAssume t=0 collateral balance equals NPV (set to 0 if false)
cvaSpreadSensiGridCVA spread sensitivity grid
cvaSpreadSensiShiftSizeCVA spread sensitivity shift size
kvaCapitalDiscountRateown capital discounting rate for discounting expected capital for KVA
kvaAlphaalpha to adjust EEPE to give EAD for risk capital
kvaRegAdjustmentregulatory adjustment, 1/min cap requirement
kvaCapitalHurdleCost of Capital for KVA = regulatory adjustment x capital hurdle
kvaOurPdFloorOur KVA PD floor
kvaTheirPdFloorTheir KVA PD floor
kvaOurCvaRiskWeightOur KVA CVA Risk Weight
kvaTheirCvaRiskWeightTheir KVA CVA Risk Weight,
cptyCube_Input Counterparty Cube
flipViewBorrowingCurvePostfixPostfix for flipView borrowing curve for fva
flipViewLendingCurvePostfixPostfix for flipView lending curve for fva
creditSimulationParametersCredit simulation parameters
creditMigrationDistributionGridCredit simulation distribution grid
creditMigrationTimeStepsCredit simulation time steps
creditStateCorrelationMatrixCredit State correlation matrix
withMporStickyDateIf set to true, cash flows in the margin period of risk are ignored in the collateral modelling
mporCashFlowModeTreatment of cash flows over the margin period of risk

Definition at line 55 of file postprocess.cpp.

71: portfolio_(portfolio), nettingSetManager_(nettingSetManager), collateralBalances_(collateralBalances),
72 market_(market), configuration_(configuration),
73 cube_(cube), cptyCube_(cptyCube), scenarioData_(scenarioData), analytics_(analytics), baseCurrency_(baseCurrency),
74 quantile_(quantile), calcType_(parseCollateralCalculationType(calculationType)), dvaName_(dvaName),
75 fvaBorrowingCurve_(fvaBorrowingCurve), fvaLendingCurve_(fvaLendingCurve), dimCalculator_(dimCalculator),
76 cubeInterpretation_(cubeInterpretation), fullInitialCollateralisation_(fullInitialCollateralisation),
77 cvaSpreadSensiGrid_(cvaSensiGrid), cvaSpreadSensiShiftSize_(cvaSensiShiftSize),
78 kvaCapitalDiscountRate_(kvaCapitalDiscountRate), kvaAlpha_(kvaAlpha), kvaRegAdjustment_(kvaRegAdjustment),
79 kvaCapitalHurdle_(kvaCapitalHurdle), kvaOurPdFloor_(kvaOurPdFloor), kvaTheirPdFloor_(kvaTheirPdFloor),
80 kvaOurCvaRiskWeight_(kvaOurCvaRiskWeight), kvaTheirCvaRiskWeight_(kvaTheirCvaRiskWeight),
81 creditSimulationParameters_(creditSimulationParameters),
82 creditMigrationDistributionGrid_(creditMigrationDistributionGrid),
83 creditMigrationTimeSteps_(creditMigrationTimeSteps), creditStateCorrelationMatrix_(creditStateCorrelationMatrix),
84 withMporStickyDate_(withMporStickyDate), mporCashFlowMode_(mporCashFlowMode) {
85
86 QL_REQUIRE(cubeInterpretation_ != nullptr, "PostProcess: cubeInterpretation is not given.");
87
88 if (mporCashFlowMode_ == MporCashFlowMode::Unspecified) {
89 mporCashFlowMode_ = withMporStickyDate_ ? MporCashFlowMode::NonePay : MporCashFlowMode::BothPay;
90 }
91
92 QL_REQUIRE(!withMporStickyDate_ || mporCashFlowMode_ == MporCashFlowMode::NonePay,
93 "PostProcess: MporMode StickyDate supports only MporCashFlowMode NonePay");
94 QL_REQUIRE(cubeInterpretation_->storeFlows() || withMporStickyDate || mporCashFlowMode_ == MporCashFlowMode::BothPay,
95 "PostProcess: If cube does not hold any mpor flows and MporMode is set to ActualDate, then "
96 "MporCashFlowMode must "
97 "be set to BothPay");
98
99 bool isRegularCubeStorage = !cubeInterpretation_->withCloseOutLag();
100
101 LOG("cube storage is regular: " << isRegularCubeStorage);
102 LOG("cube dates: " << cube->dates().size());
103
104 QL_REQUIRE(marginalAllocationLimit > 0.0, "positive allocationLimit expected");
105
106 // check portfolio and cube have the same trade ids, in the same order
107 QL_REQUIRE(portfolio->size() == cube_->idsAndIndexes().size(),
108 "PostProcess::PostProcess(): portfolio size ("
109 << portfolio->size() << ") does not match cube trade size (" << cube_->idsAndIndexes().size() << ")");
110
111 auto portfolioIt = portfolio->trades().begin();
112 auto cubeIdIt = cube_->idsAndIndexes().begin();
113 for (size_t i = 0; i < portfolio->size(); i++, portfolioIt++, cubeIdIt++) {
114 const std::string& portfolioTradeId = portfolioIt->first;
115 const std::string& cubeTradeId = cubeIdIt->first;
116 QL_REQUIRE(portfolioTradeId == cubeTradeId, "PostProcess::PostProcess(): portfolio trade #"
117 << i << " (id=" << portfolioTradeId
118 << ") does not match cube trade id (" << cubeTradeId);
119 }
120
121 if (analytics_["dynamicCredit"]) {
122 QL_REQUIRE(cptyCube_, "cptyCube cannot be null when dynamicCredit is ON");
123 // check portfolio and cptyCube have the same counterparties, in the same order
124 auto cptyIds = portfolio->counterparties();
125 cptyIds.insert(dvaName_);
126 QL_REQUIRE(cptyIds.size() == cptyCube_->idsAndIndexes().size(),
127 "PostProcess::PostProcess(): portfolio counterparty size ("
128 << cptyIds.size() << ") does not match cpty cube trade size ("
129 << cptyCube_->idsAndIndexes().size() << ")");
130
131 auto cptyIt = cptyIds.begin();
132 cubeIdIt = cptyCube_->idsAndIndexes().begin();
133 for (size_t i = 0; i < cptyIds.size(); ++i, ++cptyIt, ++cubeIdIt) {
134 const std::string& counterpartyId = *cptyIt;
135 const std::string& cubeTradeId = cubeIdIt->first;
136 QL_REQUIRE(counterpartyId == cubeTradeId, "PostProcess::PostProcess(): portfolio counterparty #"
137 << i << " (id=" << counterpartyId
138 << ") does not match cube name id (" << cubeTradeId);
139 }
140 }
141
142 ExposureAllocator::AllocationMethod allocationMethod = parseAllocationMethod(allocMethod);
143
144 /***********************************************
145 * Step 0: Netting as of today
146 * a) Compute the netting set NPV as of today
147 * b) Find the final maturity of the netting set
148 */
149 LOG("Compute netting set NPVs as of today and netting set maturity");
150 // Don't use Settings::instance().evaluationDate() here, this has moved to simulation end date.
151 Date today = market->asofDate();
152 LOG("AsOfDate = " << QuantLib::io::iso_date(today));
153
154 /***************************************************************
155 * Step 1: Dynamic Initial Margin calculation
156 * Fills DIM cube per netting set that can be
157 * - returned to be further analysed
158 * - used in collateral calculation
159 * - used in MVA calculation
160 */
161 if (analytics_["dim"] || analytics_["mva"]) {
162 QL_REQUIRE(dimCalculator_, "DIM calculator not set");
163 dimCalculator_->build();
164 }
165
166 /************************************************************
167 * Step 2: Trade Exposure and Netting
168 * a) Aggregation across scenarios per trade and date
169 * This yields single trade exposure profiles, EPE and ENE
170 * b) Aggregation of NPVs within netting sets per date
171 * and scenario. This prepares the netting set exposure
172 * calculation below
173 */
175 QuantLib::ext::make_shared<ExposureCalculator>(
176 portfolio, cube_, cubeInterpretation_,
177 market_, analytics_["exerciseNextBreak"], baseCurrency_, configuration_,
178 quantile_, calcType_, analytics_["dynamicCredit"], analytics_["flipViewXVA"]
179 );
180 exposureCalculator_->build();
181
182 /******************************************************************
183 * Step 3: Netting set exposure and allocation to trades
184 *
185 * a) Compute all netting set exposure profiles EPE and ENE using
186 * collateral if CSAs are given and active.
187 * b) Compute the expected collateral balance for each netting set.
188 * c) Allocate each netting set's exposure profile to the trade
189 * level such that the trade exposures add up to the netting
190 * set exposure.
191 * Reference:
192 * Michael Pykhtin & Dan Rosen, Pricing Counterparty Risk
193 * at the Trade Level and CVA Allocations, October 2010
194 */
195 nettedExposureCalculator_ = QuantLib::ext::make_shared<NettedExposureCalculator>(
196 portfolio_, market_, cube_, baseCurrency, configuration_, quantile_, calcType_, analytics_["dynamicCredit"],
198 exposureCalculator_->nettingSetCloseOutValue(), exposureCalculator_->nettingSetMporPositiveFlow(),
199 exposureCalculator_->nettingSetMporNegativeFlow(), scenarioData_, cubeInterpretation_, analytics_["dim"],
201 allocationMethod == ExposureAllocator::AllocationMethod::Marginal, marginalAllocationLimit,
205
206 /********************************************************
207 * Update Stand Alone XVAs
208 * needed for some of the simple allocation methods below
209 */
210 if (analytics_["dynamicCredit"]) {
211 cvaCalculator_ = QuantLib::ext::make_shared<DynamicCreditXvaCalculator>(
214 dimCalculator, exposureCalculator_->exposureCube(),
215 nettedExposureCalculator_->exposureCube(), cptyCube_,
220 flipViewBorrowingCurvePostfix, flipViewLendingCurvePostfix);
221 } else {
222 cvaCalculator_ = QuantLib::ext::make_shared<StaticCreditXvaCalculator>(
225 dimCalculator, exposureCalculator_->exposureCube(),
226 nettedExposureCalculator_->exposureCube(),
231 flipViewBorrowingCurvePostfix, flipViewLendingCurvePostfix);
232 }
233 cvaCalculator_->build();
234
235 /***************************
236 * Simple allocation methods
237 */
238 QuantLib::ext::shared_ptr<ExposureAllocator> exposureAllocator;
239 if (allocationMethod == ExposureAllocator::AllocationMethod::Marginal) {
240 DLOG("Marginal Calculation handled in NettedExposureCalculator");
241 }
243 exposureAllocator = QuantLib::ext::make_shared<RelativeFairValueNetExposureAllocator>(
244 portfolio, exposureCalculator_->exposureCube(),
245 nettedExposureCalculator_->exposureCube(), cube_,
250 exposureAllocator = QuantLib::ext::make_shared<RelativeFairValueGrossExposureAllocator>(
251 portfolio, exposureCalculator_->exposureCube(),
252 nettedExposureCalculator_->exposureCube(), cube_,
256 else if (allocationMethod == ExposureAllocator::AllocationMethod::RelativeXVA)
257 exposureAllocator = QuantLib::ext::make_shared<RelativeXvaExposureAllocator>(
258 portfolio, exposureCalculator_->exposureCube(),
259 nettedExposureCalculator_->exposureCube(), cube_,
260 cvaCalculator_->tradeCva(), cvaCalculator_->tradeDva(),
261 cvaCalculator_->nettingSetSumCva(), cvaCalculator_->nettingSetSumDva(),
265 else if (allocationMethod == ExposureAllocator::AllocationMethod::None)
266 exposureAllocator = QuantLib::ext::make_shared<NoneExposureAllocator>(
267 portfolio, exposureCalculator_->exposureCube(),
268 nettedExposureCalculator_->exposureCube());
269 else
270 QL_FAIL("allocationMethod " << allocationMethod << " not available");
271 if(exposureAllocator)
272 exposureAllocator->build();
273
274 /********************************************************
275 * Update Allocated XVAs
276 */
277 if (analytics_["dynamicCredit"]) {
278 allocatedCvaCalculator_ = QuantLib::ext::make_shared<DynamicCreditXvaCalculator>(
280 analytics_["dim"], dimCalculator, exposureCalculator_->exposureCube(),
283 NettedExposureCalculator::ExposureIndex::ENE, 0, analytics_["flipViewXVA"], flipViewBorrowingCurvePostfix,
284 flipViewLendingCurvePostfix);
285 } else {
286 allocatedCvaCalculator_ = QuantLib::ext::make_shared<StaticCreditXvaCalculator>(
288 analytics_["dim"], dimCalculator, exposureCalculator_->exposureCube(),
291 NettedExposureCalculator::ExposureIndex::ENE, analytics_["flipViewXVA"], flipViewBorrowingCurvePostfix,
292 flipViewLendingCurvePostfix);
293 }
295
296 /********************************************************
297 * Cache average EPE and ENE
298 */
299 for (const auto& [tradeId,_]: tradeIds()) {
300 tradeEPE_[tradeId] = exposureCalculator_->epe(tradeId);
301 tradeENE_[tradeId] = exposureCalculator_->ene(tradeId);
302 allocatedTradeEPE_[tradeId] = exposureCalculator_->allocatedEpe(tradeId);
303 allocatedTradeENE_[tradeId] = exposureCalculator_->allocatedEne(tradeId);
304 }
305 for (const auto& [nettingSetId, pos] : nettingSetIds()) {
306 netEPE_[nettingSetId] = nettedExposureCalculator_->epe(nettingSetId);
307 netENE_[nettingSetId] = nettedExposureCalculator_->ene(nettingSetId);
308 }
309
310 /********************************************************
311 * Calculate netting set KVA-CCR and KVA-CVA
312 */
314
315 /***************************************
316 * Calculate netting set CVA sensitivity
317 */
319
320 /***************************************
321 * Credit migration analysis
322 */
323 if (analytics_["creditMigration"]) {
324 creditMigrationCalculator_ = QuantLib::ext::make_shared<CreditMigrationCalculator>(
332 }
333}
const std::string configuration_
Real kvaCapitalDiscountRate_
QuantLib::ext::shared_ptr< Market > market_
const std::map< string, Size > tradeIds()
Return list of Trade IDs in the portfolio.
string fvaBorrowingCurve_
QuantLib::ext::shared_ptr< ExposureCalculator > exposureCalculator_
map< string, vector< Real > > netEPE_
Real cvaSpreadSensiShiftSize_
const map< string, string > & counterpartyId()
Return the map of counterparty Ids.
Real kvaOurPdFloor_
Real kvaCapitalHurdle_
bool fullInitialCollateralisation_
std::vector< std::vector< Real > > creditMigrationCdf_
const QuantLib::ext::shared_ptr< NPVCube > & cptyCube()
Inspector for the input Cpty cube (by name, time, scenario)
string dvaName_
vector< Period > cvaSpreadSensiGrid_
string fvaLendingCurve_
void updateNettingSetKVA()
map< string, bool > analytics_
const QuantLib::ext::shared_ptr< NPVCube > & cube()
Inspector for the input NPV cube (by trade, time, scenario)
map< string, vector< Real > > allocatedTradeEPE_
map< string, vector< Real > > tradeEPE_
QuantLib::ext::shared_ptr< ValueAdjustmentCalculator > allocatedCvaCalculator_
map< string, vector< Real > > allocatedTradeENE_
QuantLib::ext::shared_ptr< Portfolio > portfolio_
QuantLib::ext::shared_ptr< NettedExposureCalculator > nettedExposureCalculator_
const std::map< string, Size > nettingSetIds()
Return list of netting set IDs in the portfolio.
void updateNettingSetCvaSensitivity()
QuantLib::ext::shared_ptr< AggregationScenarioData > scenarioData_
QuantLib::ext::shared_ptr< CubeInterpretation > cubeInterpretation_
map< string, vector< Real > > tradeENE_
map< string, vector< Real > > netENE_
std::vector< Size > creditMigrationTimeSteps_
QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > dimCalculator_
CollateralExposureHelper::CalculationType calcType_
std::vector< Real > creditMigrationUpperBucketBounds_
QuantLib::ext::shared_ptr< CollateralBalances > collateralBalances_
QuantLib::ext::shared_ptr< CreditSimulationParameters > creditSimulationParameters_
MporCashFlowMode mporCashFlowMode_
Matrix creditStateCorrelationMatrix_
QuantLib::ext::shared_ptr< NPVCube > cptyCube_
Real kvaTheirPdFloor_
QuantLib::ext::shared_ptr< NettingSetManager > nettingSetManager_
Real kvaTheirCvaRiskWeight_
std::vector< Real > creditMigrationDistributionGrid_
Real quantile_
Real kvaAlpha_
Real kvaRegAdjustment_
Real kvaOurCvaRiskWeight_
QuantLib::ext::shared_ptr< CreditMigrationCalculator > creditMigrationCalculator_
bool withMporStickyDate_
std::vector< std::vector< Real > > creditMigrationPdf_
string baseCurrency_
QuantLib::ext::shared_ptr< NPVCube > cube_
QuantLib::ext::shared_ptr< ValueAdjustmentCalculator > cvaCalculator_
#define LOG(text)
#define DLOG(text)
ExposureAllocator::AllocationMethod parseAllocationMethod(const string &s)
Convert text representation to ExposureAllocator::AllocationMethod.
CollateralExposureHelper::CalculationType parseCollateralCalculationType(const string &s)
Convert text representation to CollateralExposureHelper::CalculationType.
+ Here is the call graph for this function:

Member Function Documentation

◆ setDimCalculator()

void setDimCalculator ( QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator dimCalculator)

Definition at line 174 of file postprocess.hpp.

174 {
175 dimCalculator_ = dimCalculator;
176 }

◆ spreadSensitivityTimes()

const vector< Real > & spreadSensitivityTimes ( )

Definition at line 178 of file postprocess.hpp.

178{ return cvaSpreadSensiTimes_; }
vector< Time > cvaSpreadSensiTimes_

◆ spreadSensitivityGrid()

const vector< Period > & spreadSensitivityGrid ( )

Definition at line 179 of file postprocess.hpp.

179{ return cvaSpreadSensiGrid_; }

◆ tradeIds()

const std::map< string, Size > tradeIds ( )

Return list of Trade IDs in the portfolio.

Definition at line 182 of file postprocess.hpp.

182 {
183 return cube()->idsAndIndexes();
184 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nettingSetIds()

const std::map< string, Size > nettingSetIds ( )

Return list of netting set IDs in the portfolio.

Definition at line 186 of file postprocess.hpp.

186 {
187 return netCube()->idsAndIndexes();
188 }
const QuantLib::ext::shared_ptr< NPVCube > & netCube()
Return the for the input NPV cube after netting and collateral (by netting set, time,...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ counterpartyId()

const map< string, string > & counterpartyId ( )

Return the map of counterparty Ids.

Definition at line 190 of file postprocess.hpp.

190{ return nettedExposureCalculator_->counterpartyMap(); }
+ Here is the caller graph for this function:

◆ tradeEPE()

const vector< Real > & tradeEPE ( const string &  tradeId)

Return trade level Expected Positive Exposure evolution.

Definition at line 594 of file postprocess.cpp.

594 {
595 QL_REQUIRE(tradeEPE_.find(tradeId) != tradeEPE_.end(), "Trade " << tradeId << " not found in exposure map");
596 return tradeEPE_[tradeId];
597}

◆ tradeENE()

const vector< Real > & tradeENE ( const string &  tradeId)

Return trade level Expected Negative Exposure evolution.

Definition at line 599 of file postprocess.cpp.

599 {
600 QL_REQUIRE(tradeENE_.find(tradeId) != tradeENE_.end(), "Trade " << tradeId << " not found in exposure map");
601 return tradeENE_[tradeId];
602}

◆ tradeEE_B()

const vector< Real > & tradeEE_B ( const string &  tradeId)

Return trade level Basel Expected Exposure evolution.

Definition at line 604 of file postprocess.cpp.

604 {
605 return exposureCalculator_->ee_b(tradeId);
606}

◆ tradeEPE_B()

const Real & tradeEPE_B ( const string &  tradeId)

Return trade level Basel Expected Positive Exposure evolution.

Definition at line 608 of file postprocess.cpp.

608 {
609 return exposureCalculator_->epe_b(tradeId);
610}

◆ tradeEEE_B()

const vector< Real > & tradeEEE_B ( const string &  tradeId)

Return trade level Effective Expected Exposure evolution.

Definition at line 612 of file postprocess.cpp.

612 {
613 return exposureCalculator_->eee_b(tradeId);
614}

◆ tradeEEPE_B()

const Real & tradeEEPE_B ( const string &  tradeId)

Return trade level Effective Expected Positive Exposure evolution.

Definition at line 616 of file postprocess.cpp.

616 {
617 return exposureCalculator_->eepe_b(tradeId);
618}

◆ tradePFE()

const vector< Real > & tradePFE ( const string &  tradeId)

Return trade level Potential Future Exposure evolution.

Definition at line 620 of file postprocess.cpp.

620 {
621 return exposureCalculator_->pfe(tradeId);
622}

◆ netEPE()

const vector< Real > & netEPE ( const string &  nettingSetId)

Return Netting Set Expected Positive Exposure evolution.

Definition at line 624 of file postprocess.cpp.

624 {
625 QL_REQUIRE(netEPE_.find(nettingSetId) != netEPE_.end(),
626 "Netting set " << nettingSetId << " not found in exposure map");
627 return netEPE_[nettingSetId];
628}

◆ netENE()

const vector< Real > & netENE ( const string &  nettingSetId)

Return Netting Set Expected Negative Exposure evolution.

Definition at line 630 of file postprocess.cpp.

630 {
631 QL_REQUIRE(netENE_.find(nettingSetId) != netENE_.end(),
632 "Netting set " << nettingSetId << " not found in exposure map");
633 return netENE_[nettingSetId];
634}

◆ netEE_B()

const vector< Real > & netEE_B ( const string &  nettingSetId)

Return Netting Set Basel Expected Exposure evolution.

Definition at line 650 of file postprocess.cpp.

650 {
651 return nettedExposureCalculator_->ee_b(nettingSetId);
652}

◆ netEPE_B()

const Real & netEPE_B ( const string &  nettingSetId)

Return Netting Set Basel Expected Positive Exposure evolution.

Definition at line 654 of file postprocess.cpp.

654 {
655 return nettedExposureCalculator_->epe_b(nettingSetId);
656}

◆ netEEE_B()

const vector< Real > & netEEE_B ( const string &  nettingSetId)

Return Netting Set Effective Expected Exposure evolution.

Definition at line 658 of file postprocess.cpp.

658 {
659 return nettedExposureCalculator_->eee_b(nettingSetId);
660}

◆ netEEPE_B()

const Real & netEEPE_B ( const string &  nettingSetId)

Return Netting Set Effective Expected Positive Exposure evolution.

Definition at line 662 of file postprocess.cpp.

662 {
663 return nettedExposureCalculator_->eepe_b(nettingSetId);
664}

◆ netPFE()

const vector< Real > & netPFE ( const string &  nettingSetId)

Return Netting Set Potential Future Exposure evolution.

Definition at line 666 of file postprocess.cpp.

666 {
667 return nettedExposureCalculator_->pfe(nettingSetId);
668}

◆ expectedCollateral()

const vector< Real > & expectedCollateral ( const string &  nettingSetId)

Return the netting set's expected collateral evolution.

Definition at line 670 of file postprocess.cpp.

670 {
671 return nettedExposureCalculator_->expectedCollateral(nettingSetId);
672}

◆ colvaIncrements()

const vector< Real > & colvaIncrements ( const string &  nettingSetId)

Return the netting set's expected COLVA increments through time.

Definition at line 674 of file postprocess.cpp.

674 {
675 return nettedExposureCalculator_->colvaIncrements(nettingSetId);
676}

◆ collateralFloorIncrements()

const vector< Real > & collateralFloorIncrements ( const string &  nettingSetId)

Return the netting set's expected Collateral Floor increments through time.

Definition at line 678 of file postprocess.cpp.

678 {
679 return nettedExposureCalculator_->collateralFloorIncrements(nettingSetId);
680}

◆ allocatedTradeEPE()

const vector< Real > & allocatedTradeEPE ( const string &  tradeId)

Return the trade EPE, allocated down from the netting set level.

Definition at line 682 of file postprocess.cpp.

682 {
683 QL_REQUIRE(allocatedTradeEPE_.find(tradeId) != allocatedTradeEPE_.end(),
684 "Trade " << tradeId << " not found in exposure map");
685 return allocatedTradeEPE_[tradeId];
686}

◆ allocatedTradeENE()

const vector< Real > & allocatedTradeENE ( const string &  tradeId)

Return trade ENE, allocated down from the netting set level.

Definition at line 688 of file postprocess.cpp.

688 {
689 QL_REQUIRE(allocatedTradeENE_.find(tradeId) != allocatedTradeENE_.end(),
690 "Trade " << tradeId << " not found in exposure map");
691 return allocatedTradeENE_[tradeId];
692}

◆ netCvaHazardRateSensitivity()

vector< Real > netCvaHazardRateSensitivity ( const string &  nettingSetId)

Return Netting Set CVA Hazard Rate Sensitivity vector.

Definition at line 636 of file postprocess.cpp.

636 {
637 if (netCvaHazardRateSensi_.find(nettingSetId) != netCvaHazardRateSensi_.end())
638 return netCvaHazardRateSensi_[nettingSetId];
639 else
640 return vector<Real>();
641}
map< string, vector< Real > > netCvaHazardRateSensi_

◆ netCvaSpreadSensitivity() [1/2]

vector< Real > netCvaSpreadSensitivity ( const string &  nettingSetId)

Return Netting Set CVA Spread Sensitivity vector.

Definition at line 643 of file postprocess.cpp.

643 {
644 if (netCvaSpreadSensi_.find(nettingSetId) != netCvaSpreadSensi_.end())
645 return netCvaSpreadSensi_[nettingSetId];
646 else
647 return vector<Real>();
648}
map< string, vector< Real > > netCvaSpreadSensi_

◆ netCvaSpreadSensitivity() [2/2]

const std::map< std::string, std::vector< QuantLib::Real > > & netCvaSpreadSensitivity ( ) const

Return Netting Set CVA Spread Sensitivity vector.

Definition at line 241 of file postprocess.hpp.

241{ return netCvaSpreadSensi_; }

◆ tradeCVA()

Real tradeCVA ( const string &  tradeId)

Return trade (stand-alone) CVA.

Definition at line 694 of file postprocess.cpp.

694 {
695 return cvaCalculator_->tradeCva(tradeId);
696}

◆ tradeDVA()

Real tradeDVA ( const string &  tradeId)

Return trade (stand-alone) DVA.

Definition at line 698 of file postprocess.cpp.

698 {
699 return cvaCalculator_->tradeDva(tradeId);
700}

◆ tradeMVA()

Real tradeMVA ( const string &  tradeId)

Return trade (stand-alone) MVA.

Definition at line 702 of file postprocess.cpp.

702 {
703 return cvaCalculator_->tradeMva(tradeId);
704}

◆ tradeFBA()

Real tradeFBA ( const string &  tradeId)

Return trade (stand-alone) FBA (Funding Benefit Adjustment)

Definition at line 706 of file postprocess.cpp.

706 {
707 return cvaCalculator_->tradeFba(tradeId);
708}

◆ tradeFCA()

Real tradeFCA ( const string &  tradeId)

Return trade (stand-alone) FCA (Funding Cost Adjustment)

Definition at line 710 of file postprocess.cpp.

710 {
711 return cvaCalculator_->tradeFca(tradeId);
712}

◆ tradeFBA_exOwnSP()

Real tradeFBA_exOwnSP ( const string &  tradeId)

Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding own survival probability.

Definition at line 714 of file postprocess.cpp.

714 {
715 return cvaCalculator_->tradeFba_exOwnSp(tradeId);
716}

◆ tradeFCA_exOwnSP()

Real tradeFCA_exOwnSP ( const string &  tradeId)

Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding own survival probability.

Definition at line 718 of file postprocess.cpp.

718 {
719 return cvaCalculator_->tradeFca_exOwnSp(tradeId);
720}

◆ tradeFBA_exAllSP()

Real tradeFBA_exAllSP ( const string &  tradeId)

Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding both survival probabilities.

Definition at line 722 of file postprocess.cpp.

722 {
723 return cvaCalculator_->tradeFba_exAllSp(tradeId);
724}

◆ tradeFCA_exAllSP()

Real tradeFCA_exAllSP ( const string &  tradeId)

Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding both survival probabilities.

Definition at line 726 of file postprocess.cpp.

726 {
727 return cvaCalculator_->tradeFca_exAllSp(tradeId);
728}

◆ allocatedTradeCVA()

Real allocatedTradeCVA ( const string &  tradeId)

Return allocated trade CVA (trade CVAs add up to netting set CVA)

Definition at line 793 of file postprocess.cpp.

793 {
794 return allocatedCvaCalculator_->tradeCva(allocatedTradeId);
795}

◆ allocatedTradeDVA()

Real allocatedTradeDVA ( const string &  tradeId)

Return allocated trade DVA (trade DVAs add up to netting set DVA)

Definition at line 797 of file postprocess.cpp.

797 {
798 return allocatedCvaCalculator_->tradeDva(allocatedTradeId);
799}

◆ nettingSetCVA()

Real nettingSetCVA ( const string &  nettingSetId)

Return netting set CVA.

Definition at line 730 of file postprocess.cpp.

730 {
731 return cvaCalculator_->nettingSetCva(nettingSetId);
732}

◆ nettingSetDVA()

Real nettingSetDVA ( const string &  nettingSetId)

Return netting set DVA.

Definition at line 734 of file postprocess.cpp.

734 {
735 return cvaCalculator_->nettingSetDva(nettingSetId);
736}

◆ nettingSetMVA()

Real nettingSetMVA ( const string &  nettingSetId)

Return netting set MVA.

Definition at line 738 of file postprocess.cpp.

738 {
739 return cvaCalculator_->nettingSetMva(nettingSetId);
740
741}

◆ nettingSetFBA()

Real nettingSetFBA ( const string &  nettingSetId)

Return netting set FBA.

Definition at line 743 of file postprocess.cpp.

743 {
744 return cvaCalculator_->nettingSetFba(nettingSetId);
745
746}

◆ nettingSetFCA()

Real nettingSetFCA ( const string &  nettingSetId)

Return netting set FCA.

Definition at line 748 of file postprocess.cpp.

748 {
749 return cvaCalculator_->nettingSetFca(nettingSetId);
750
751}

◆ nettingSetOurKVACCR()

Real nettingSetOurKVACCR ( const string &  nettingSetId)

Return netting set KVA-CCR.

Definition at line 753 of file postprocess.cpp.

753 {
754 QL_REQUIRE(ourNettingSetKVACCR_.find(nettingSetId) != ourNettingSetKVACCR_.end(),
755 "NettingSetId " << nettingSetId << " not found in nettingSet KVACCR map");
756 return ourNettingSetKVACCR_[nettingSetId];
757}
map< string, Real > ourNettingSetKVACCR_

◆ nettingSetTheirKVACCR()

Real nettingSetTheirKVACCR ( const string &  nettingSetId)

Return netting set KVA-CCR from counterparty perspective.

Definition at line 759 of file postprocess.cpp.

759 {
760 QL_REQUIRE(theirNettingSetKVACCR_.find(nettingSetId) != theirNettingSetKVACCR_.end(),
761 "NettingSetId " << nettingSetId << " not found in nettingSet KVACCR map");
762 return theirNettingSetKVACCR_[nettingSetId];
763}
map< string, Real > theirNettingSetKVACCR_

◆ nettingSetOurKVACVA()

Real nettingSetOurKVACVA ( const string &  nettingSetId)

Return netting set KVA-CVA.

Definition at line 765 of file postprocess.cpp.

765 {
766 QL_REQUIRE(ourNettingSetKVACVA_.find(nettingSetId) != ourNettingSetKVACVA_.end(),
767 "NettingSetId " << nettingSetId << " not found in nettingSet KVACVA map");
768 return ourNettingSetKVACVA_[nettingSetId];
769}
map< string, Real > ourNettingSetKVACVA_

◆ nettingSetTheirKVACVA()

Real nettingSetTheirKVACVA ( const string &  nettingSetId)

Return netting set KVA-CVA from counterparty perspective.

Definition at line 771 of file postprocess.cpp.

771 {
772 QL_REQUIRE(theirNettingSetKVACVA_.find(nettingSetId) != theirNettingSetKVACVA_.end(),
773 "NettingSetId " << nettingSetId << " not found in nettingSet KVACVA map");
774 return theirNettingSetKVACVA_[nettingSetId];
775}
map< string, Real > theirNettingSetKVACVA_

◆ nettingSetFBA_exOwnSP()

Real nettingSetFBA_exOwnSP ( const string &  nettingSetId)

Return netting set FBA excluding own survival probability.

Definition at line 777 of file postprocess.cpp.

777 {
778 return cvaCalculator_->nettingSetFba_exOwnSp(nettingSetId);
779}

◆ nettingSetFCA_exOwnSP()

Real nettingSetFCA_exOwnSP ( const string &  nettingSetId)

Return netting set FCA excluding own survival probability.

Definition at line 781 of file postprocess.cpp.

781 {
782 return cvaCalculator_->nettingSetFca_exOwnSp(nettingSetId);
783}

◆ nettingSetFBA_exAllSP()

Real nettingSetFBA_exAllSP ( const string &  nettingSetId)

Return netting set FBA excluding both survival probabilities.

Definition at line 785 of file postprocess.cpp.

785 {
786 return cvaCalculator_->nettingSetFba_exAllSp(nettingSetId);
787}

◆ nettingSetFCA_exAllSP()

Real nettingSetFCA_exAllSP ( const string &  nettingSetId)

Return netting set FCA excluding both survival probabilities.

Definition at line 789 of file postprocess.cpp.

789 {
790 return cvaCalculator_->nettingSetFca_exAllSp(nettingSetId);
791}

◆ nettingSetCOLVA()

Real nettingSetCOLVA ( const string &  nettingSetId)

Return netting set COLVA.

Definition at line 801 of file postprocess.cpp.

801 {
802 return nettedExposureCalculator_->colva(nettingSetId);
803}

◆ nettingSetCollateralFloor()

Real nettingSetCollateralFloor ( const string &  nettingSetId)

Return netting set Collateral Floor value.

Definition at line 805 of file postprocess.cpp.

805 {
806 return nettedExposureCalculator_->collateralFloor(nettingSetId);
807}

◆ cube()

const QuantLib::ext::shared_ptr< NPVCube > & cube ( )

Inspector for the input NPV cube (by trade, time, scenario)

Definition at line 297 of file postprocess.hpp.

297{ return cube_; }
+ Here is the caller graph for this function:

◆ cptyCube()

const QuantLib::ext::shared_ptr< NPVCube > & cptyCube ( )

Inspector for the input Cpty cube (by name, time, scenario)

Definition at line 299 of file postprocess.hpp.

299{ return cptyCube_; }

◆ netCube()

const QuantLib::ext::shared_ptr< NPVCube > & netCube ( )

Return the for the input NPV cube after netting and collateral (by netting set, time, scenario)

Definition at line 301 of file postprocess.hpp.

301{ return nettedExposureCalculator_->nettedCube(); }
+ Here is the caller graph for this function:

◆ exportDimEvolution()

void exportDimEvolution ( ore::data::Report dimEvolutionReport)

Return the dynamic initial margin cube (regression approach)

Write average (over samples) DIM evolution through time for all netting sets

Definition at line 809 of file postprocess.cpp.

809 {
810 dimCalculator_->exportDimEvolution(dimEvolutionReport);
811}

◆ exportDimRegression()

void exportDimRegression ( const std::string &  nettingSet,
const std::vector< Size > &  timeSteps,
const std::vector< QuantLib::ext::shared_ptr< ore::data::Report > > &  dimRegReports 
)

Write DIM as a function of sample netting set NPV for a given time step.

Definition at line 813 of file postprocess.cpp.

814 {
815
816 QuantLib::ext::shared_ptr<RegressionDynamicInitialMarginCalculator> regCalc =
817 QuantLib::ext::dynamic_pointer_cast<RegressionDynamicInitialMarginCalculator>(dimCalculator_);
818
819 if (regCalc)
820 regCalc->exportDimRegression(nettingSet, timeSteps, dimRegReports);
821}

◆ cvaSpreadSensiShiftSize()

QuantLib::Real cvaSpreadSensiShiftSize ( )

get the cvaSpreadSensiShiftSize

Definition at line 311 of file postprocess.hpp.

311{ return cvaSpreadSensiShiftSize_; }

◆ creditMigrationUpperBucketBounds()

const std::vector< Real > & creditMigrationUpperBucketBounds ( ) const

get the credit migration pnl distributions for each time step

Definition at line 314 of file postprocess.hpp.

◆ creditMigrationCdf()

const std::vector< std::vector< Real > > & creditMigrationCdf ( ) const

Definition at line 315 of file postprocess.hpp.

315{ return creditMigrationCdf_; }

◆ creditMigrationPdf()

const std::vector< std::vector< Real > > & creditMigrationPdf ( ) const

Definition at line 316 of file postprocess.hpp.

316{ return creditMigrationPdf_; }

◆ collateralPaths()

QuantLib::ext::shared_ptr< vector< QuantLib::ext::shared_ptr< CollateralAccount > > > collateralPaths ( const string &  nettingSetId,
const QuantLib::ext::shared_ptr< NettingSetManager > &  nettingSetManager,
const QuantLib::ext::shared_ptr< Market > &  market,
const std::string &  configuration,
const QuantLib::ext::shared_ptr< AggregationScenarioData > &  scenarioData,
Size  dates,
Size  samples,
const vector< vector< Real > > &  nettingSetValue,
Real  nettingSetValueToday,
const Date &  nettingSetMaturity 
)
protected

Helper function to return the collateral account evolution for a given netting set.

◆ updateNettingSetKVA()

void updateNettingSetKVA ( )
protected

Definition at line 335 of file postprocess.cpp.

335 {
336
337 // Loop over all netting sets
338 for (const auto& [nettingSetId,pos] : nettingSetIds()) {
339 // Init results
340 ourNettingSetKVACCR_[nettingSetId] = 0.0;
341 theirNettingSetKVACCR_[nettingSetId] = 0.0;
342 ourNettingSetKVACVA_[nettingSetId] = 0.0;
343 theirNettingSetKVACVA_[nettingSetId] = 0.0;
344 }
345
346 if (!analytics_["kva"])
347 return;
348
349 LOG("Update netting set KVA");
350
351 vector<Date> dateVector = cube_->dates();
352 Size dates = dateVector.size();
353 Date today = market_->asofDate();
354 Handle<YieldTermStructure> discountCurve = market_->discountCurve(baseCurrency_, configuration_);
355 DayCounter dc = ActualActual(ActualActual::ISDA);
356
357 // Loop over all netting sets
358 for (const auto& [nettingSetId, pos] : nettingSetIds()) {
359 string cid;
360 if (analytics_["flipViewXVA"]) {
361 cid = dvaName_;
362 } else {
363 cid = nettedExposureCalculator_->counterparty(nettingSetId);
364 }
365 LOG("KVA for netting set " << nettingSetId);
366
367 // Main input are the EPE and ENE profiles, previously computed
368 vector<Real> epe = netEPE_[nettingSetId];
369 vector<Real> ene = netENE_[nettingSetId];
370
371 // PD from counterparty Dts, floored to avoid 0 ...
372 // Today changed to today+1Y to get the one-year PD
373 Handle<DefaultProbabilityTermStructure> cvaDts = market_->defaultCurve(cid, configuration_)->curve();
374 QL_REQUIRE(!cvaDts.empty(), "Default curve missing for counterparty " << cid);
375 Real cvaRR = market_->recoveryRate(cid, configuration_)->value();
376 Real PD1 = std::max(cvaDts->defaultProbability(today + 1 * Years), 0.000000000001);
377 Real LGD1 = (1 - cvaRR);
378
379 // FIXME: if flipViewXVA is sufficient, then all code for their KVA-CCR could be discarded here...
380 Handle<DefaultProbabilityTermStructure> dvaDts;
381 Real dvaRR = 0.0;
382 Real PD2 = 0;
383 if (analytics_["flipViewXVA"]) {
384 dvaName_ = nettedExposureCalculator_->counterparty(nettingSetId);
385 }
386 if (dvaName_ != "") {
387 dvaDts = market_->defaultCurve(dvaName_, configuration_)->curve();
388 dvaRR = market_->recoveryRate(dvaName_, configuration_)->value();
389 PD2 = std::max(dvaDts->defaultProbability(today + 1 * Years), 0.000000000001);
390 } else {
391 ALOG("dvaName not specified, own PD set to zero for their KVA calculation");
392 }
393 Real LGD2 = (1 - dvaRR);
394
395 // Granularity adjustment, Gordy (2004):
396 Real rho1 = 0.12 * (1 - std::exp(-50 * PD1)) / (1 - std::exp(-50)) +
397 0.24 * (1 - (1 - std::exp(-50 * PD1)) / (1 - std::exp(-50)));
398 Real rho2 = 0.12 * (1 - std::exp(-50 * PD2)) / (1 - std::exp(-50)) +
399 0.24 * (1 - (1 - std::exp(-50 * PD2)) / (1 - std::exp(-50)));
400
401 // Basel II internal rating based (IRB) estimate of worst case PD:
402 // Large homogeneous pool (LHP) approximation of Vasicek (1997)
403 InverseCumulativeNormal icn;
404 CumulativeNormalDistribution cnd;
405 Real PD99_1 = cnd((icn(PD1) + std::sqrt(rho1) * icn(0.999)) / (std::sqrt(1 - rho1))) - PD1;
406 Real PD99_2 = cnd((icn(PD2) + std::sqrt(rho2) * icn(0.999)) / (std::sqrt(1 - rho2))) - PD2;
407
408 // KVA regulatory PD, worst case PD, floored at 0.03 for corporates and banks, not floored for sovereigns
409 Real kva99PD1 = std::max(PD99_1, kvaTheirPdFloor_);
410 Real kva99PD2 = std::max(PD99_2, kvaOurPdFloor_);
411
412 // Factor B(PD) for the maturity adjustment factor, B(PD) = (0.11852 - 0.05478 * ln(PD)) ^ 2
413 Real kvaMatAdjB1 = std::pow((0.11852 - 0.05478 * std::log(PD1)), 2.0);
414 Real kvaMatAdjB2 = std::pow((0.11852 - 0.05478 * std::log(PD2)), 2.0);
415
416 DLOG("Our KVA-CCR " << nettingSetId << ": PD=" << PD1);
417 DLOG("Our KVA-CCR " << nettingSetId << ": LGD=" << LGD1);
418 DLOG("Our KVA-CCR " << nettingSetId << ": rho=" << rho1);
419 DLOG("Our KVA-CCR " << nettingSetId << ": PD99=" << PD99_1);
420 DLOG("Our KVA-CCR " << nettingSetId << ": PD Floor=" << kvaTheirPdFloor_);
421 DLOG("Our KVA-CCR " << nettingSetId << ": Floored PD99=" << kva99PD1);
422 DLOG("Our KVA-CCR " << nettingSetId << ": B(PD)=" << kvaMatAdjB1);
423
424 DLOG("Their KVA-CCR " << nettingSetId << ": PD=" << PD2);
425 DLOG("Their KVA-CCR " << nettingSetId << ": LGD=" << LGD2);
426 DLOG("Their KVA-CCR " << nettingSetId << ": rho=" << rho2);
427 DLOG("Their KVA-CCR " << nettingSetId << ": PD99=" << PD99_2);
428 DLOG("Their KVA-CCR " << nettingSetId << ": PD Floor=" << kvaOurPdFloor_);
429 DLOG("Their KVA-CCR " << nettingSetId << ": Floored PD99=" << kva99PD2);
430 DLOG("Their KVA-CCR " << nettingSetId << ": B(PD)=" << kvaMatAdjB2);
431
432 for (Size j = 0; j < dates; ++j) {
433 Date d0 = j == 0 ? today : cube_->dates()[j - 1];
434 Date d1 = cube_->dates()[j];
435
436 // Preprocess:
437 // 1) Effective maturity from effective expected exposure as of time j
438 // Index _1 corresponds to our perspective, index _2 to their perspective.
439 // 2) Basel EEPE as of time j, i.e. as time average over EEE, starting at time j
440 // More accuracy may be achieved here by using a Longstaff-Schwartz method / regression
441 Real eee_kva_1 = 0.0, eee_kva_2 = 0.0;
442 Real effMatNumer1 = 0.0, effMatNumer2 = 0.0;
443 Real effMatDenom1 = 0.0, effMatDenom2 = 0.0;
444 Real eepe_kva_1 = 0, eepe_kva_2 = 0.0;
445 Size kmax = j, count = 0;
446 // Cut off index for EEPE/EENE calculation: One year ahead
447 while (dateVector[kmax] < dateVector[j] + 1 * Years + 4 * Days && kmax < dates - 1)
448 kmax++;
449 Real sumdt = 0.0, eee1_b = 0.0, eee2_b = 0.0;
450 for (Size k = j; k < dates; ++k) {
451 Date d2 = cube_->dates()[k];
452 Date prevDate = k == 0 ? today : dateVector[k - 1];
453
454 eee_kva_1 = std::max(eee_kva_1, epe[k + 1]);
455 eee_kva_2 = std::max(eee_kva_2, ene[k + 1]);
456
457 // Components of the KVA maturity adjustment MA as of time j
458 if (dc.yearFraction(d1, d2) > 1.0) {
459 effMatNumer1 += epe[k + 1] * dc.yearFraction(prevDate, d2);
460 effMatNumer2 += ene[k + 1] * dc.yearFraction(prevDate, d2);
461 }
462 if (dc.yearFraction(d1, d2) <= 1.0) {
463 effMatDenom1 += eee_kva_1 * dc.yearFraction(prevDate, d2);
464 effMatDenom2 += eee_kva_2 * dc.yearFraction(prevDate, d2);
465 }
466
467 if (k < kmax) {
468 Real dt = dc.yearFraction(cube_->dates()[k], cube_->dates()[k + 1]);
469 sumdt += dt;
470 Real epe_b = epe[k + 1] / discountCurve->discount(dateVector[k]);
471 Real ene_b = ene[k + 1] / discountCurve->discount(dateVector[k]);
472 eee1_b = std::max(epe_b, eee1_b);
473 eee2_b = std::max(ene_b, eee2_b);
474 eepe_kva_1 += eee1_b * dt;
475 eepe_kva_2 += eee2_b * dt;
476 count++;
477 }
478 }
479
480 // Normalize EEPE/EENE calculation
481 eepe_kva_1 = count > 0 ? eepe_kva_1 / sumdt : 0.0;
482 eepe_kva_2 = count > 0 ? eepe_kva_2 / sumdt : 0.0;
483
484 // KVA CCR using the IRB risk weighted asset method and IMM:
485 // KVA effective maturity of the nettingSet, capped at 5
486 Real kvaNWMaturity1 = std::min(1.0 + (effMatDenom1 == 0.0 ? 0.0 : effMatNumer1 / effMatDenom1), 5.0);
487 Real kvaNWMaturity2 = std::min(1.0 + (effMatDenom2 == 0.0 ? 0.0 : effMatNumer2 / effMatDenom2), 5.0);
488
489 // Maturity adjustment factor for the RWA method:
490 // MA(PD, M) = (1 + (M - 2.5) * B(PD)) / (1 - 1.5 * B(PD)), capped at 5, floored at 1, M = effective
491 // maturity
492 Real kvaMatAdj1 =
493 std::max(std::min((1.0 + (kvaNWMaturity1 - 2.5) * kvaMatAdjB1) / (1.0 - 1.5 * kvaMatAdjB1), 5.0), 1.0);
494 Real kvaMatAdj2 =
495 std::max(std::min((1.0 + (kvaNWMaturity2 - 2.5) * kvaMatAdjB2) / (1.0 - 1.5 * kvaMatAdjB2), 5.0), 1.0);
496
497 // CCR Capital: RC = EAD x LGD x PD99.9 x MA(PD, M); EAD = alpha x EEPE(t) (approximated by EPE here);
498 Real kvaRC1 = kvaAlpha_ * eepe_kva_1 * LGD1 * kva99PD1 * kvaMatAdj1;
499 Real kvaRC2 = kvaAlpha_ * eepe_kva_2 * LGD2 * kva99PD2 * kvaMatAdj2;
500
501 // Expected risk capital discounted at capital discount rate
502 Real kvaCapitalDiscount = 1 / std::pow(1 + kvaCapitalDiscountRate_, dc.yearFraction(today, d0));
503 Real kvaCCRIncrement1 =
504 kvaRC1 * kvaCapitalDiscount * dc.yearFraction(d0, d1) * kvaCapitalHurdle_ * kvaRegAdjustment_;
505 Real kvaCCRIncrement2 =
506 kvaRC2 * kvaCapitalDiscount * dc.yearFraction(d0, d1) * kvaCapitalHurdle_ * kvaRegAdjustment_;
507
508 ourNettingSetKVACCR_[nettingSetId] += kvaCCRIncrement1;
509 theirNettingSetKVACCR_[nettingSetId] += kvaCCRIncrement2;
510
511 DLOG("Our KVA-CCR for " << nettingSetId << ": " << j << " EEPE=" << setprecision(2) << eepe_kva_1
512 << " EPE=" << epe[j] << " RC=" << kvaRC1 << " M=" << setprecision(6)
513 << kvaNWMaturity1 << " MA=" << kvaMatAdj1 << " Cost=" << setprecision(2)
514 << kvaCCRIncrement1 << " KVA=" << ourNettingSetKVACCR_[nettingSetId]);
515 DLOG("Their KVA-CCR for " << nettingSetId << ": " << j << " EENE=" << eepe_kva_2 << " ENE=" << ene[j]
516 << " RC=" << kvaRC2 << " M=" << setprecision(6) << kvaNWMaturity2
517 << " MA=" << kvaMatAdj2 << " Cost=" << setprecision(2) << kvaCCRIncrement2
518 << " KVA=" << theirNettingSetKVACCR_[nettingSetId]);
519
520 // CVA Capital
521 // effective maturity without cap at 5, DF set to 1 for IMM banks
522 // TODO: Set MA in CCR capital calculation to 1
523 Real kvaCvaMaturity1 = 1.0 + (effMatDenom1 == 0.0 ? 0.0 : effMatNumer1 / effMatDenom1);
524 Real kvaCvaMaturity2 = 1.0 + (effMatDenom2 == 0.0 ? 0.0 : effMatNumer2 / effMatDenom2);
525 Real scva1 = kvaTheirCvaRiskWeight_ * kvaCvaMaturity1 * eepe_kva_1;
526 Real scva2 = kvaOurCvaRiskWeight_ * kvaCvaMaturity2 * eepe_kva_2;
527 Real kvaCVAIncrement1 =
528 scva1 * kvaCapitalDiscount * dc.yearFraction(d0, d1) * kvaCapitalHurdle_ * kvaRegAdjustment_;
529 Real kvaCVAIncrement2 =
530 scva2 * kvaCapitalDiscount * dc.yearFraction(d0, d1) * kvaCapitalHurdle_ * kvaRegAdjustment_;
531
532 DLOG("Our KVA-CVA for " << nettingSetId << ": " << j << " EEPE=" << eepe_kva_1 << " SCVA=" << scva1
533 << " Cost=" << kvaCVAIncrement1);
534 DLOG("Their KVA-CVA for " << nettingSetId << ": " << j << " EENE=" << eepe_kva_2 << " SCVA=" << scva2
535 << " Cost=" << kvaCVAIncrement2);
536
537 ourNettingSetKVACVA_[nettingSetId] += kvaCVAIncrement1;
538 theirNettingSetKVACVA_[nettingSetId] += kvaCVAIncrement2;
539 }
540 }
541
542 LOG("Update netting set KVA done");
543}
#define ALOG(text)
std::size_t count
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNettingSetCvaSensitivity()

void updateNettingSetCvaSensitivity ( )
protected

Definition at line 545 of file postprocess.cpp.

545 {
546
547 if (!analytics_["cvaSensi"])
548 return;
549
550 LOG("Update netting set CVA sensitivities");
551
552 Handle<YieldTermStructure> discountCurve = market_->discountCurve(baseCurrency_, configuration_);
553
554 for (auto n : netEPE_) {
555 string nettingSetId = n.first;
556 vector<Real> epe = netEPE_[nettingSetId];
557 string cid;
558 Handle<DefaultProbabilityTermStructure> cvaDts;
559 Real cvaRR;
560 if (analytics_["flipViewXVA"]) {
561 cid = dvaName_;
562 } else {
563 cid = nettedExposureCalculator_->counterparty(nettingSetId);
564 }
565 cvaDts = market_->defaultCurve(cid)->curve();
566 QL_REQUIRE(!cvaDts.empty(), "Default curve missing for counterparty " << cid);
567 cvaRR = market_->recoveryRate(cid, configuration_)->value();
568
569 bool cvaSensi = analytics_["cvaSensi"];
570 LOG("CVA Sensitivity: " << cvaSensi);
571 if (cvaSensi) {
572 QuantLib::ext::shared_ptr<CVASpreadSensitivityCalculator> cvaSensiCalculator = QuantLib::ext::make_shared<CVASpreadSensitivityCalculator>(
573 nettingSetId, market_->asofDate(), epe, cube_->dates(), cvaDts, cvaRR, discountCurve, cvaSpreadSensiGrid_, cvaSpreadSensiShiftSize_);
574
575 for (Size i = 0; i < cvaSensiCalculator->shiftTimes().size(); ++i) {
576 DLOG("CVA Sensi Calculator: t=" << cvaSensiCalculator->shiftTimes()[i]
577 << " h=" << cvaSensiCalculator->hazardRateSensitivities()[i]
578 << " s=" << cvaSensiCalculator->cdsSpreadSensitivities()[i]);
579 }
580
581 netCvaHazardRateSensi_[nettingSetId] = cvaSensiCalculator->hazardRateSensitivities();
582 netCvaSpreadSensi_[nettingSetId] = cvaSensiCalculator->cdsSpreadSensitivities();
583 cvaSpreadSensiTimes_ = cvaSensiCalculator->shiftTimes();
584 } else {
585 cvaSpreadSensiTimes_ = vector<Real>();
586 netCvaHazardRateSensi_[nettingSetId] = vector<Real>();
587 netCvaSpreadSensi_[nettingSetId] = vector<Real>();
588 }
589 }
590
591 LOG("Update netting set CVA sensitivities done");
592}
Size size(const ValueType &v)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ portfolio_

QuantLib::ext::shared_ptr<Portfolio> portfolio_
protected

Definition at line 330 of file postprocess.hpp.

◆ nettingSetManager_

QuantLib::ext::shared_ptr<NettingSetManager> nettingSetManager_
protected

Definition at line 331 of file postprocess.hpp.

◆ collateralBalances_

QuantLib::ext::shared_ptr<CollateralBalances> collateralBalances_
protected

Definition at line 332 of file postprocess.hpp.

◆ market_

QuantLib::ext::shared_ptr<Market> market_
protected

Definition at line 333 of file postprocess.hpp.

◆ configuration_

const std::string configuration_
protected

Definition at line 334 of file postprocess.hpp.

◆ cube_

QuantLib::ext::shared_ptr<NPVCube> cube_
protected

Definition at line 335 of file postprocess.hpp.

◆ cptyCube_

QuantLib::ext::shared_ptr<NPVCube> cptyCube_
protected

Definition at line 336 of file postprocess.hpp.

◆ scenarioData_

QuantLib::ext::shared_ptr<AggregationScenarioData> scenarioData_
protected

Definition at line 337 of file postprocess.hpp.

◆ analytics_

map<string, bool> analytics_
protected

Definition at line 338 of file postprocess.hpp.

◆ tradeEPE_

map<string, vector<Real> > tradeEPE_
protected

Definition at line 340 of file postprocess.hpp.

◆ tradeENE_

map<string, vector<Real> > tradeENE_
protected

Definition at line 340 of file postprocess.hpp.

◆ allocatedTradeEPE_

map<string, vector<Real> > allocatedTradeEPE_
protected

Definition at line 341 of file postprocess.hpp.

◆ allocatedTradeENE_

map<string, vector<Real> > allocatedTradeENE_
protected

Definition at line 341 of file postprocess.hpp.

◆ netEPE_

map<string, vector<Real> > netEPE_
protected

Definition at line 342 of file postprocess.hpp.

◆ netENE_

map<string, vector<Real> > netENE_
protected

Definition at line 342 of file postprocess.hpp.

◆ ourNettingSetKVACCR_

map<string, Real> ourNettingSetKVACCR_
protected

Definition at line 343 of file postprocess.hpp.

◆ theirNettingSetKVACCR_

map<string, Real> theirNettingSetKVACCR_
protected

Definition at line 343 of file postprocess.hpp.

◆ ourNettingSetKVACVA_

map<string, Real> ourNettingSetKVACVA_
protected

Definition at line 343 of file postprocess.hpp.

◆ theirNettingSetKVACVA_

map<string, Real> theirNettingSetKVACVA_
protected

Definition at line 343 of file postprocess.hpp.

◆ netCvaSpreadSensi_

map<string, vector<Real> > netCvaSpreadSensi_
protected

Definition at line 344 of file postprocess.hpp.

◆ netCvaHazardRateSensi_

map<string, vector<Real> > netCvaHazardRateSensi_
protected

Definition at line 344 of file postprocess.hpp.

◆ baseCurrency_

string baseCurrency_
protected

Definition at line 348 of file postprocess.hpp.

◆ quantile_

Real quantile_
protected

Definition at line 349 of file postprocess.hpp.

◆ calcType_

Definition at line 350 of file postprocess.hpp.

◆ dvaName_

string dvaName_
protected

Definition at line 351 of file postprocess.hpp.

◆ fvaBorrowingCurve_

string fvaBorrowingCurve_
protected

Definition at line 352 of file postprocess.hpp.

◆ fvaLendingCurve_

string fvaLendingCurve_
protected

Definition at line 353 of file postprocess.hpp.

◆ dimCalculator_

QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator> dimCalculator_
protected

Definition at line 355 of file postprocess.hpp.

◆ exposureCalculator_

QuantLib::ext::shared_ptr<ExposureCalculator> exposureCalculator_
protected

Definition at line 356 of file postprocess.hpp.

◆ nettedExposureCalculator_

QuantLib::ext::shared_ptr<NettedExposureCalculator> nettedExposureCalculator_
protected

Definition at line 357 of file postprocess.hpp.

◆ cvaCalculator_

QuantLib::ext::shared_ptr<ValueAdjustmentCalculator> cvaCalculator_
protected

Definition at line 358 of file postprocess.hpp.

◆ allocatedCvaCalculator_

QuantLib::ext::shared_ptr<ValueAdjustmentCalculator> allocatedCvaCalculator_
protected

Definition at line 359 of file postprocess.hpp.

◆ cubeInterpretation_

QuantLib::ext::shared_ptr<CubeInterpretation> cubeInterpretation_
protected

Definition at line 360 of file postprocess.hpp.

◆ fullInitialCollateralisation_

bool fullInitialCollateralisation_
protected

Definition at line 361 of file postprocess.hpp.

◆ cvaSpreadSensiGrid_

vector<Period> cvaSpreadSensiGrid_
protected

Definition at line 362 of file postprocess.hpp.

◆ cvaSpreadSensiTimes_

vector<Time> cvaSpreadSensiTimes_
protected

Definition at line 363 of file postprocess.hpp.

◆ cvaSpreadSensiShiftSize_

Real cvaSpreadSensiShiftSize_
protected

Definition at line 364 of file postprocess.hpp.

◆ kvaCapitalDiscountRate_

Real kvaCapitalDiscountRate_
protected

Definition at line 365 of file postprocess.hpp.

◆ kvaAlpha_

Real kvaAlpha_
protected

Definition at line 366 of file postprocess.hpp.

◆ kvaRegAdjustment_

Real kvaRegAdjustment_
protected

Definition at line 367 of file postprocess.hpp.

◆ kvaCapitalHurdle_

Real kvaCapitalHurdle_
protected

Definition at line 368 of file postprocess.hpp.

◆ kvaOurPdFloor_

Real kvaOurPdFloor_
protected

Definition at line 369 of file postprocess.hpp.

◆ kvaTheirPdFloor_

Real kvaTheirPdFloor_
protected

Definition at line 370 of file postprocess.hpp.

◆ kvaOurCvaRiskWeight_

Real kvaOurCvaRiskWeight_
protected

Definition at line 371 of file postprocess.hpp.

◆ kvaTheirCvaRiskWeight_

Real kvaTheirCvaRiskWeight_
protected

Definition at line 372 of file postprocess.hpp.

◆ creditSimulationParameters_

QuantLib::ext::shared_ptr<CreditSimulationParameters> creditSimulationParameters_
protected

Definition at line 374 of file postprocess.hpp.

◆ creditMigrationDistributionGrid_

std::vector<Real> creditMigrationDistributionGrid_
protected

Definition at line 375 of file postprocess.hpp.

◆ creditMigrationTimeSteps_

std::vector<Size> creditMigrationTimeSteps_
protected

Definition at line 376 of file postprocess.hpp.

◆ creditStateCorrelationMatrix_

Matrix creditStateCorrelationMatrix_
protected

Definition at line 377 of file postprocess.hpp.

◆ creditMigrationCalculator_

QuantLib::ext::shared_ptr<CreditMigrationCalculator> creditMigrationCalculator_
protected

Definition at line 378 of file postprocess.hpp.

◆ creditMigrationUpperBucketBounds_

std::vector<Real> creditMigrationUpperBucketBounds_
protected

Definition at line 379 of file postprocess.hpp.

◆ creditMigrationCdf_

std::vector<std::vector<Real> > creditMigrationCdf_
protected

Definition at line 380 of file postprocess.hpp.

◆ creditMigrationPdf_

std::vector<std::vector<Real> > creditMigrationPdf_
protected

Definition at line 381 of file postprocess.hpp.

◆ withMporStickyDate_

bool withMporStickyDate_
protected

Definition at line 382 of file postprocess.hpp.

◆ mporCashFlowMode_

MporCashFlowMode mporCashFlowMode_
protected

Definition at line 383 of file postprocess.hpp.