Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
postprocess.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file orea/aggregation/postprocess.hpp
20 \brief Exposure aggregation and XVA calculation
21 \ingroup analytics
22*/
23
24#pragma once
25
35
39
40#include <ql/time/date.hpp>
41
42#include <ql/shared_ptr.hpp>
43
44namespace ore {
45namespace analytics {
46using namespace QuantLib;
47using namespace data;
48
49//! Exposure Aggregation and XVA Calculation
50/*!
51 This class aggregates NPV cube data, computes exposure statistics
52 and various XVAs, all at trade and netting set level:
53
54 1) Exposures
55 - Expected Positive Exposure, EPE: E[max(NPV(t),0) / N(t)]
56 - Expected Negative Exposure, ENE: E[max(-NPV(t),0) / N(t)]
57 - Basel Expected Exposure, EE_B: EPE(t)/P(t)
58 - Basel Expected Positive Exposure, EPE_B
59 - Basel Effective Expected Exposure, EEE_B: max( EEE_B(t-1), EE_B(t))
60 - Basel Effective Expected Positive Exposure, EEPE_B
61 - Potential Future Exposure, PFE: q-Quantile of the distribution of
62
63 2) Dynamic Initial Margin via regression
64
65 3) XVAs:
66 - Credit Value Adjustment, CVA
67 - Debit Value Adjustment, DVA
68 - Funding Value Adjustment, FVA
69 - Collateral Value Adjustment, COLVA
70 - Margin Value Adjustment, MVA
71
72 4) Allocation from netting set to trade level such that allocated contributions
73 add up to the netting set
74 - CVA and DVA
75 - EPE and ENE
76
77 All analytics are precomputed when the class constructor is called.
78 A number of inspectors described below then return the individual analytics results.
79
80 Note:
81 - exposures are discounted at the numeraire N(t) used in the
82 Monte Carlo simulation which produces the NPV cube.
83 - NPVs take collateral into account, depending on CSA settings
84
85 \ingroup analytics
86
87 \todo Introduce enumeration for TradeAction type and owner
88 \todo Interpolation for DIM(t-MPOR) when the simulation grid spacing is different from MPOR
89 \todo Revise alternatives to the RelativeXVA exposure and XVA allocation method
90 \todo Add trade-level MVA
91 \todo Take the spread received on posted initial margin into account in MVA calculation
92*/
94public:
95 //! Constructor
96 PostProcess( //! Trade portfolio to identify e.g. netting set, maturity, break dates for each trade
97 const QuantLib::ext::shared_ptr<Portfolio>& portfolio,
98 //! Netting set manager to access CSA details for each netting set
99 const QuantLib::ext::shared_ptr<NettingSetManager>& nettingSetManager,
100 //! Collateral balances (VM, IM, IA)
101 const QuantLib::ext::shared_ptr<CollateralBalances>& collateralBalances,
102 //! Market data object to access e.g. discounting and funding curves
103 const QuantLib::ext::shared_ptr<Market>& market,
104 //! Market configuration to use
105 const std::string& configuration,
106 //! Input NPV Cube
107 const QuantLib::ext::shared_ptr<NPVCube>& cube,
108 //! Subset of simulated market data, index fixings and FX spot rates, associated with the NPV cube
109 const QuantLib::ext::shared_ptr<AggregationScenarioData>& scenarioData,
110 //! Selection of analytics to be produced
111 const map<string, bool>& analytics,
112 //! Expression currency for all results
113 const string& baseCurrency,
114 //! Method to be used for Exposure/XVA allocation down to trade level
115 const string& allocationMethod,
116 //! Cutoff parameter for the marginal allocation method below which we switch to equal distribution
117 Real cvaMarginalAllocationLimit,
118 //! Quantile for Potential Future Exposure output
119 Real quantile = 0.95,
120 //! Collateral calculation type to be used, see class %CollateralExposureHelper
121 const string& calculationType = "Symmetric",
122 //! Credit curve name to be used for "our" credit risk in DVA calculations
123 const string& dvaName = "",
124 //! Borrowing curve name to be used in FVA calculations
125 const string& fvaBorrowingCurve = "",
126 //! Lending curve name to be used in FVA calculations
127 const string& fvaLendingCurve = "",
128 //! Dynamic Initial Margin Calculator
129 const QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator>& dimCalculator =
130 QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator>(),
131 //! Interpreter for cube storage (where to find which data items)
132 const QuantLib::ext::shared_ptr<CubeInterpretation>& cubeInterpretation = QuantLib::ext::shared_ptr<CubeInterpretation>(),
133 //! Assume t=0 collateral balance equals NPV (set to 0 if false)
134 bool fullInitialCollateralisation = false,
135 //! CVA spread sensitivity grid
136 vector<Period> cvaSpreadSensiGrid = {6 * Months, 1 * Years, 3 * Years, 5 * Years, 10 * Years},
137 //! CVA spread sensitivity shift size
138 Real cvaSpreadSensiShiftSize = 0.0001,
139 //! own capital discounting rate for discounting expected capital for KVA
140 Real kvaCapitalDiscountRate = 0.10,
141 //! alpha to adjust EEPE to give EAD for risk capital
142 Real kvaAlpha = 1.4,
143 //! regulatory adjustment, 1/min cap requirement
144 Real kvaRegAdjustment = 12.5,
145 //! Cost of Capital for KVA = regulatory adjustment x capital hurdle
146 Real kvaCapitalHurdle = 0.012,
147 //! Our KVA PD floor
148 Real kvaOurPdFloor = 0.03,
149 //! Their KVA PD floor
150 Real kvaTheirPdFloor = 0.03,
151 //! Our KVA CVA Risk Weight
152 Real kvaOurCvaRiskWeight = 0.05,
153 //! Their KVA CVA Risk Weight,
154 Real kvaTheirCvaRiskWeight = 0.05,
155 //! Input Counterparty Cube
156 const QuantLib::ext::shared_ptr<NPVCube>& cptyCube_ = nullptr,
157 //! Postfix for flipView borrowing curve for fva
158 const string& flipViewBorrowingCurvePostfix = "_BORROW",
159 //! Postfix for flipView lending curve for fva
160 const string& flipViewLendingCurvePostfix = "_LEND",
161 //! Credit simulation parameters
162 const QuantLib::ext::shared_ptr<CreditSimulationParameters>& creditSimulationParameters = nullptr,
163 //! Credit simulation distribution grid
164 const std::vector<Real>& creditMigrationDistributionGrid = {},
165 //! Credit simulation time steps
166 const std::vector<Size>& creditMigrationTimeSteps = {},
167 //! Credit State correlation matrix
168 const Matrix& creditStateCorrelationMatrix = Matrix(),
169 //! If set to true, cash flows in the margin period of risk are ignored in the collateral modelling
170 bool withMporStickyDate = false,
171 //! Treatment of cash flows over the margin period of risk
172 const MporCashFlowMode mporCashFlowMode = MporCashFlowMode::Unspecified);
173
174 void setDimCalculator(QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator> dimCalculator) {
175 dimCalculator_ = dimCalculator;
176 }
177
178 const vector<Real>& spreadSensitivityTimes() { return cvaSpreadSensiTimes_; }
179 const vector<Period>& spreadSensitivityGrid() { return cvaSpreadSensiGrid_; }
180
181 //! Return list of Trade IDs in the portfolio
182 const std::map<string, Size> tradeIds() {
183 return cube()->idsAndIndexes();
184 }
185 //! Return list of netting set IDs in the portfolio
186 const std::map<string, Size> nettingSetIds() {
187 return netCube()->idsAndIndexes();
188 }
189 //! Return the map of counterparty Ids
190 const map<string, string>& counterpartyId() { return nettedExposureCalculator_->counterpartyMap(); }
191
192 //! Return trade level Expected Positive Exposure evolution
193 const vector<Real>& tradeEPE(const string& tradeId);
194 //! Return trade level Expected Negative Exposure evolution
195 const vector<Real>& tradeENE(const string& tradeId);
196 //! Return trade level Basel Expected Exposure evolution
197 const vector<Real>& tradeEE_B(const string& tradeId);
198 //! Return trade level Basel Expected Positive Exposure evolution
199 const Real& tradeEPE_B(const string& tradeId);
200 //! Return trade level Effective Expected Exposure evolution
201 const vector<Real>& tradeEEE_B(const string& tradeId);
202 //! Return trade level Effective Expected Positive Exposure evolution
203 const Real& tradeEEPE_B(const string& tradeId);
204 //! Return trade level Potential Future Exposure evolution
205 const vector<Real>& tradePFE(const string& tradeId);
206 // const vector<Real>& tradeVAR(const string& tradeId);
207
208 //! Return Netting Set Expected Positive Exposure evolution
209 const vector<Real>& netEPE(const string& nettingSetId);
210 //! Return Netting Set Expected Negative Exposure evolution
211 const vector<Real>& netENE(const string& nettingSetId);
212 //! Return Netting Set Basel Expected Exposure evolution
213 const vector<Real>& netEE_B(const string& nettingSetId);
214 //! Return Netting Set Basel Expected Positive Exposure evolution
215 const Real& netEPE_B(const string& nettingSetId);
216 //! Return Netting Set Effective Expected Exposure evolution
217 const vector<Real>& netEEE_B(const string& nettingSetId);
218 //! Return Netting Set Effective Expected Positive Exposure evolution
219 const Real& netEEPE_B(const string& nettingSetId);
220 //! Return Netting Set Potential Future Exposure evolution
221 const vector<Real>& netPFE(const string& nettingSetId);
222 // const vector<Real>& netVAR(const string& nettingSetId);
223
224 //! Return the netting set's expected collateral evolution
225 const vector<Real>& expectedCollateral(const string& nettingSetId);
226 //! Return the netting set's expected COLVA increments through time
227 const vector<Real>& colvaIncrements(const string& nettingSetId);
228 //! Return the netting set's expected Collateral Floor increments through time
229 const vector<Real>& collateralFloorIncrements(const string& nettingSetId);
230
231 //! Return the trade EPE, allocated down from the netting set level
232 const vector<Real>& allocatedTradeEPE(const string& tradeId);
233 //! Return trade ENE, allocated down from the netting set level
234 const vector<Real>& allocatedTradeENE(const string& tradeId);
235
236 //! Return Netting Set CVA Hazard Rate Sensitivity vector
237 vector<Real> netCvaHazardRateSensitivity(const string& nettingSetId);
238 //! Return Netting Set CVA Spread Sensitivity vector
239 vector<Real> netCvaSpreadSensitivity(const string& nettingSetId);
240 //! Return Netting Set CVA Spread Sensitivity vector
241 const std::map<std::string, std::vector<QuantLib::Real>>& netCvaSpreadSensitivity() const { return netCvaSpreadSensi_; }
242
243 //! Return trade (stand-alone) CVA
244 Real tradeCVA(const string& tradeId);
245 //! Return trade (stand-alone) DVA
246 Real tradeDVA(const string& tradeId);
247 //! Return trade (stand-alone) MVA
248 Real tradeMVA(const string& tradeId);
249 //! Return trade (stand-alone) FBA (Funding Benefit Adjustment)
250 Real tradeFBA(const string& tradeId);
251 //! Return trade (stand-alone) FCA (Funding Cost Adjustment)
252 Real tradeFCA(const string& tradeId);
253 //! Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding own survival probability
254 Real tradeFBA_exOwnSP(const string& tradeId);
255 //! Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding own survival probability
256 Real tradeFCA_exOwnSP(const string& tradeId);
257 //! Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding both survival probabilities
258 Real tradeFBA_exAllSP(const string& tradeId);
259 //! Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding both survival probabilities
260 Real tradeFCA_exAllSP(const string& tradeId);
261 //! Return allocated trade CVA (trade CVAs add up to netting set CVA)
262 Real allocatedTradeCVA(const string& tradeId);
263 //! Return allocated trade DVA (trade DVAs add up to netting set DVA)
264 Real allocatedTradeDVA(const string& tradeId);
265 //! Return netting set CVA
266 Real nettingSetCVA(const string& nettingSetId);
267 //! Return netting set DVA
268 Real nettingSetDVA(const string& nettingSetId);
269 //! Return netting set MVA
270 Real nettingSetMVA(const string& nettingSetId);
271 //! Return netting set FBA
272 Real nettingSetFBA(const string& nettingSetId);
273 //! Return netting set FCA
274 Real nettingSetFCA(const string& nettingSetId);
275 //! Return netting set KVA-CCR
276 Real nettingSetOurKVACCR(const string& nettingSetId);
277 //! Return netting set KVA-CCR from counterparty perspective
278 Real nettingSetTheirKVACCR(const string& nettingSetId);
279 //! Return netting set KVA-CVA
280 Real nettingSetOurKVACVA(const string& nettingSetId);
281 //! Return netting set KVA-CVA from counterparty perspective
282 Real nettingSetTheirKVACVA(const string& nettingSetId);
283 //! Return netting set FBA excluding own survival probability
284 Real nettingSetFBA_exOwnSP(const string& nettingSetId);
285 //! Return netting set FCA excluding own survival probability
286 Real nettingSetFCA_exOwnSP(const string& nettingSetId);
287 //! Return netting set FBA excluding both survival probabilities
288 Real nettingSetFBA_exAllSP(const string& nettingSetId);
289 //! Return netting set FCA excluding both survival probabilities
290 Real nettingSetFCA_exAllSP(const string& nettingSetId);
291 //! Return netting set COLVA
292 Real nettingSetCOLVA(const string& nettingSetId);
293 //! Return netting set Collateral Floor value
294 Real nettingSetCollateralFloor(const string& nettingSetId);
295
296 //! Inspector for the input NPV cube (by trade, time, scenario)
297 const QuantLib::ext::shared_ptr<NPVCube>& cube() { return cube_; }
298 //! Inspector for the input Cpty cube (by name, time, scenario)
299 const QuantLib::ext::shared_ptr<NPVCube>& cptyCube() { return cptyCube_; }
300 //! Return the for the input NPV cube after netting and collateral (by netting set, time, scenario)
301 const QuantLib::ext::shared_ptr<NPVCube>& netCube() { return nettedExposureCalculator_->nettedCube(); }
302 //! Return the dynamic initial margin cube (regression approach)
303 //const QuantLib::ext::shared_ptr<NPVCube>& dimCube() { return dimCube_; }
304 //! Write average (over samples) DIM evolution through time for all netting sets
305 void exportDimEvolution(ore::data::Report& dimEvolutionReport);
306 //! Write DIM as a function of sample netting set NPV for a given time step
307 void exportDimRegression(const std::string& nettingSet, const std::vector<Size>& timeSteps,
308 const std::vector<QuantLib::ext::shared_ptr<ore::data::Report>>& dimRegReports);
309
310 //! get the cvaSpreadSensiShiftSize
312
313 //! get the credit migration pnl distributions for each time step
314 const std::vector<Real>& creditMigrationUpperBucketBounds() const { return creditMigrationUpperBucketBounds_; }
315 const std::vector<std::vector<Real>>& creditMigrationCdf() const { return creditMigrationCdf_; }
316 const std::vector<std::vector<Real>>& creditMigrationPdf() const { return creditMigrationPdf_; }
317
318protected:
319 //! Helper function to return the collateral account evolution for a given netting set
320 QuantLib::ext::shared_ptr<vector<QuantLib::ext::shared_ptr<CollateralAccount>>>
321 collateralPaths(const string& nettingSetId, const QuantLib::ext::shared_ptr<NettingSetManager>& nettingSetManager,
322 const QuantLib::ext::shared_ptr<Market>& market, const std::string& configuration,
323 const QuantLib::ext::shared_ptr<AggregationScenarioData>& scenarioData, Size dates, Size samples,
324 const vector<vector<Real>>& nettingSetValue, Real nettingSetValueToday,
325 const Date& nettingSetMaturity);
326
327 void updateNettingSetKVA();
329
330 QuantLib::ext::shared_ptr<Portfolio> portfolio_;
331 QuantLib::ext::shared_ptr<NettingSetManager> nettingSetManager_;
332 QuantLib::ext::shared_ptr<CollateralBalances> collateralBalances_;
333 QuantLib::ext::shared_ptr<Market> market_;
334 const std::string configuration_;
335 QuantLib::ext::shared_ptr<NPVCube> cube_;
336 QuantLib::ext::shared_ptr<NPVCube> cptyCube_;
337 QuantLib::ext::shared_ptr<AggregationScenarioData> scenarioData_;
338 map<string, bool> analytics_;
339
340 map<string, vector<Real>> tradeEPE_, tradeENE_;
341 map<string, vector<Real>> allocatedTradeEPE_, allocatedTradeENE_;
342 map<string, vector<Real>> netEPE_, netENE_;
344 map<string, vector<Real>> netCvaSpreadSensi_, netCvaHazardRateSensi_;
345
346 // vector<string> tradeIds_;
347 // vector<string> nettingSetIds_;
351 string dvaName_;
354
355 QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator> dimCalculator_;
356 QuantLib::ext::shared_ptr<ExposureCalculator> exposureCalculator_;
357 QuantLib::ext::shared_ptr<NettedExposureCalculator> nettedExposureCalculator_;
358 QuantLib::ext::shared_ptr<ValueAdjustmentCalculator> cvaCalculator_;
359 QuantLib::ext::shared_ptr<ValueAdjustmentCalculator> allocatedCvaCalculator_;
360 QuantLib::ext::shared_ptr<CubeInterpretation> cubeInterpretation_;
362 vector<Period> cvaSpreadSensiGrid_;
373
374 QuantLib::ext::shared_ptr<CreditSimulationParameters> creditSimulationParameters_;
376 std::vector<Size> creditMigrationTimeSteps_;
378 QuantLib::ext::shared_ptr<CreditMigrationCalculator> creditMigrationCalculator_;
380 std::vector<std::vector<Real>> creditMigrationCdf_;
381 std::vector<std::vector<Real>> creditMigrationPdf_;
384};
385
386} // namespace analytics
387} // namespace ore
this class holds data associated to scenarios
Exposure Aggregation and XVA Calculation.
Definition: postprocess.hpp:93
const Real & tradeEEPE_B(const string &tradeId)
Return trade level Effective Expected Positive Exposure evolution.
Real tradeFBA_exAllSP(const string &tradeId)
Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding both survival probabilities.
Real tradeFCA(const string &tradeId)
Return trade (stand-alone) FCA (Funding Cost Adjustment)
const vector< Real > & tradeEEE_B(const string &tradeId)
Return trade level Effective Expected Exposure evolution.
map< string, Real > theirNettingSetKVACVA_
const std::string configuration_
Real nettingSetOurKVACVA(const string &nettingSetId)
Return netting set KVA-CVA.
Real kvaCapitalDiscountRate_
QuantLib::ext::shared_ptr< Market > market_
QuantLib::Real cvaSpreadSensiShiftSize()
get the cvaSpreadSensiShiftSize
Real nettingSetCollateralFloor(const string &nettingSetId)
Return netting set Collateral Floor value.
const std::map< string, Size > tradeIds()
Return list of Trade IDs in the portfolio.
const vector< Real > & tradeENE(const string &tradeId)
Return trade level Expected Negative Exposure evolution.
string fvaBorrowingCurve_
const vector< Period > & spreadSensitivityGrid()
QuantLib::ext::shared_ptr< ExposureCalculator > exposureCalculator_
Real nettingSetFCA_exOwnSP(const string &nettingSetId)
Return netting set FCA excluding own survival probability.
const vector< Real > & colvaIncrements(const string &nettingSetId)
Return the netting set's expected COLVA increments through time.
const vector< Real > & netEEE_B(const string &nettingSetId)
Return Netting Set Effective Expected Exposure evolution.
map< string, vector< Real > > netEPE_
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.
const vector< Real > & netEPE(const string &nettingSetId)
Return Netting Set Expected Positive Exposure evolution.
Real cvaSpreadSensiShiftSize_
Real tradeFBA(const string &tradeId)
Return trade (stand-alone) FBA (Funding Benefit Adjustment)
const vector< Real > & netPFE(const string &nettingSetId)
Return Netting Set Potential Future Exposure evolution.
const map< string, string > & counterpartyId()
Return the map of counterparty Ids.
Real kvaOurPdFloor_
Real kvaCapitalHurdle_
Real nettingSetCVA(const string &nettingSetId)
Return netting set CVA.
const vector< Real > & netEE_B(const string &nettingSetId)
Return Netting Set Basel Expected Exposure evolution.
bool fullInitialCollateralisation_
Real tradeFBA_exOwnSP(const string &tradeId)
Return trade (stand-alone) FBA (Funding Benefit Adjustment) excluding own survival probability.
Real nettingSetMVA(const string &nettingSetId)
Return netting set MVA.
void setDimCalculator(QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > dimCalculator)
std::vector< std::vector< Real > > creditMigrationCdf_
map< string, vector< Real > > netCvaSpreadSensi_
const vector< Real > & allocatedTradeEPE(const string &tradeId)
Return the trade EPE, allocated down from the netting set level.
Real nettingSetFBA_exOwnSP(const string &nettingSetId)
Return netting set FBA excluding own survival probability.
const QuantLib::ext::shared_ptr< NPVCube > & cptyCube()
Inspector for the input Cpty cube (by name, time, scenario)
const vector< Real > & expectedCollateral(const string &nettingSetId)
Return the netting set's expected collateral evolution.
Real nettingSetTheirKVACVA(const string &nettingSetId)
Return netting set KVA-CVA from counterparty perspective.
string dvaName_
Real nettingSetFCA(const string &nettingSetId)
Return netting set FCA.
const vector< Real > & spreadSensitivityTimes()
const vector< Real > & tradeEPE(const string &tradeId)
Return trade level Expected Positive Exposure evolution.
vector< Period > cvaSpreadSensiGrid_
const Real & tradeEPE_B(const string &tradeId)
Return trade level Basel Expected Positive Exposure evolution.
Real nettingSetFBA(const string &nettingSetId)
Return netting set FBA.
string fvaLendingCurve_
Real tradeMVA(const string &tradeId)
Return trade (stand-alone) MVA.
void updateNettingSetKVA()
const Real & netEEPE_B(const string &nettingSetId)
Return Netting Set Effective Expected Positive Exposure evolution.
vector< Real > netCvaHazardRateSensitivity(const string &nettingSetId)
Return Netting Set CVA Hazard Rate Sensitivity vector.
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_
Real nettingSetCOLVA(const string &nettingSetId)
Return netting set COLVA.
map< string, vector< Real > > allocatedTradeENE_
QuantLib::ext::shared_ptr< Portfolio > portfolio_
vector< Time > cvaSpreadSensiTimes_
QuantLib::ext::shared_ptr< NettedExposureCalculator > nettedExposureCalculator_
const std::map< string, Size > nettingSetIds()
Return list of netting set IDs in the portfolio.
const vector< Real > & tradePFE(const string &tradeId)
Return trade level Potential Future Exposure evolution.
void updateNettingSetCvaSensitivity()
const QuantLib::ext::shared_ptr< NPVCube > & netCube()
Return the for the input NPV cube after netting and collateral (by netting set, time,...
QuantLib::ext::shared_ptr< AggregationScenarioData > scenarioData_
Real tradeCVA(const string &tradeId)
Return trade (stand-alone) CVA.
QuantLib::ext::shared_ptr< CubeInterpretation > cubeInterpretation_
map< string, Real > ourNettingSetKVACCR_
map< string, vector< Real > > tradeENE_
map< string, vector< Real > > netENE_
Real allocatedTradeDVA(const string &tradeId)
Return allocated trade DVA (trade DVAs add up to netting set DVA)
const std::vector< Real > & creditMigrationUpperBucketBounds() const
get the credit migration pnl distributions for each time step
std::vector< Size > creditMigrationTimeSteps_
QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > dimCalculator_
CollateralExposureHelper::CalculationType calcType_
Real tradeFCA_exAllSP(const string &tradeId)
Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding both survival probabilities.
const vector< Real > & allocatedTradeENE(const string &tradeId)
Return trade ENE, allocated down from the netting set level.
std::vector< Real > creditMigrationUpperBucketBounds_
QuantLib::ext::shared_ptr< CollateralBalances > collateralBalances_
Real allocatedTradeCVA(const string &tradeId)
Return allocated trade CVA (trade CVAs add up to netting set CVA)
Real nettingSetDVA(const string &nettingSetId)
Return netting set DVA.
Real tradeFCA_exOwnSP(const string &tradeId)
Return trade (stand-alone) FCA (Funding Cost Adjustment) excluding own survival probability.
QuantLib::ext::shared_ptr< CreditSimulationParameters > creditSimulationParameters_
MporCashFlowMode mporCashFlowMode_
Matrix creditStateCorrelationMatrix_
QuantLib::ext::shared_ptr< NPVCube > cptyCube_
Real nettingSetOurKVACCR(const string &nettingSetId)
Return netting set KVA-CCR.
Real kvaTheirPdFloor_
QuantLib::ext::shared_ptr< NettingSetManager > nettingSetManager_
const std::vector< std::vector< Real > > & creditMigrationPdf() const
Real kvaTheirCvaRiskWeight_
std::vector< Real > creditMigrationDistributionGrid_
Real quantile_
Real kvaAlpha_
Real nettingSetFBA_exAllSP(const string &nettingSetId)
Return netting set FBA excluding both survival probabilities.
Real kvaRegAdjustment_
map< string, Real > ourNettingSetKVACVA_
Real kvaOurCvaRiskWeight_
map< string, Real > theirNettingSetKVACCR_
QuantLib::ext::shared_ptr< CreditMigrationCalculator > creditMigrationCalculator_
void exportDimEvolution(ore::data::Report &dimEvolutionReport)
Return the dynamic initial margin cube (regression approach)
Real tradeDVA(const string &tradeId)
Return trade (stand-alone) DVA.
const std::vector< std::vector< Real > > & creditMigrationCdf() const
Real nettingSetFCA_exAllSP(const string &nettingSetId)
Return netting set FCA excluding both survival probabilities.
const vector< Real > & netENE(const string &nettingSetId)
Return Netting Set Expected Negative Exposure evolution.
map< string, vector< Real > > netCvaHazardRateSensi_
bool withMporStickyDate_
const std::map< std::string, std::vector< QuantLib::Real > > & netCvaSpreadSensitivity() const
Return Netting Set CVA Spread Sensitivity vector.
std::vector< std::vector< Real > > creditMigrationPdf_
const vector< Real > & tradeEE_B(const string &tradeId)
Return trade level Basel Expected Exposure evolution.
string baseCurrency_
QuantLib::ext::shared_ptr< NPVCube > cube_
const vector< Real > & collateralFloorIncrements(const string &nettingSetId)
Return the netting set's expected Collateral Floor increments through time.
QuantLib::ext::shared_ptr< ValueAdjustmentCalculator > cvaCalculator_
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.
Real nettingSetTheirKVACCR(const string &nettingSetId)
Return netting set KVA-CCR from counterparty perspective.
const Real & netEPE_B(const string &nettingSetId)
Return Netting Set Basel Expected Positive Exposure evolution.
Collateral Exposure Helper Functions (stored in base currency)
Exposure calculator.
class describing the layout of an npv cube and aggregation scenario data
Dynamic Initial Margin calculator base class.
Exposure calculator.
A cube implementation that stores the cube in memory.
data
Exposure calculator.
CVA calculator base class.