Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
xvacalculator.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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
21
25
26#include <ql/errors.hpp>
27
28using namespace std;
29using namespace QuantLib;
30
31// using namespace boost::accumulators;
32
33namespace ore {
34namespace analytics {
35
37 const QuantLib::ext::shared_ptr<Portfolio> portfolio,
38 const QuantLib::ext::shared_ptr<Market> market,
39 const string& configuration,
40 const string& baseCurrency,
41 const string& dvaName,
42 const string& fvaBorrowingCurve,
43 const string& fvaLendingCurve,
44 const bool applyDynamicInitialMargin,
45 const QuantLib::ext::shared_ptr<DynamicInitialMarginCalculator> dimCalculator,
46 const QuantLib::ext::shared_ptr<NPVCube> tradeExposureCube,
47 const QuantLib::ext::shared_ptr<NPVCube> nettingSetExposureCube,
48 const Size tradeEpeIndex, const Size tradeEneIndex,
49 const Size nettingSetEpeIndex, const Size nettingSetEneIndex,
50 const bool flipViewXVA, const string& flipViewBorrowingCurvePostfix, const string& flipViewLendingCurvePostfix)
51 : portfolio_(portfolio), market_(market), configuration_(configuration),
52 baseCurrency_(baseCurrency), dvaName_(dvaName),
53 fvaBorrowingCurve_(fvaBorrowingCurve), fvaLendingCurve_(fvaLendingCurve),
54 applyDynamicInitialMargin_(applyDynamicInitialMargin),
55 dimCalculator_(dimCalculator),
56 tradeExposureCube_(tradeExposureCube),
57 nettingSetExposureCube_(nettingSetExposureCube),
58 tradeEpeIndex_(tradeEpeIndex), tradeEneIndex_(tradeEneIndex), nettingSetEpeIndex_(nettingSetEpeIndex),
59 nettingSetEneIndex_(nettingSetEneIndex), flipViewXVA_(flipViewXVA),
60 flipViewBorrowingCurvePostfix_(flipViewBorrowingCurvePostfix), flipViewLendingCurvePostfix_(flipViewLendingCurvePostfix) {
61
62 QL_REQUIRE(portfolio_, "portfolio is null");
63
64 for (const auto& [tradeId, trade] : portfolio_->trades()) {
65 string nettingSetId = trade->envelope().nettingSetId();
66 if (nettingSetCpty_.find(nettingSetId) == nettingSetCpty_.end()) {
67 nettingSetCpty_[nettingSetId] = trade->envelope().counterparty();
68 }
69 }
70
71
72
73 QL_REQUIRE(tradeExposureCube_->numIds() == portfolio_->trades().size(),
74 "number of trades in tradeExposureCube and portfolio mismatch ("
75 << tradeExposureCube_->numIds() << " vs " << portfolio_->trades().size() << ")");
76
77 QL_REQUIRE(nettingSetExposureCube_->numIds() == nettingSetCpty_.size(),
78 "number of netting sets in nettingSetExposureCube and nettingSetCpty map mismatch ("
79 << nettingSetExposureCube_->numIds() << " vs " << nettingSetCpty_.size() << ")");
80
81 QL_REQUIRE(tradeExposureCube_->numDates() == nettingSetExposureCube_->numDates(),
82 "number of dates in tradeExposureCube and nettingSetExposureCube mismatch ("
83 << tradeExposureCube_->numDates() << " vs " << nettingSetExposureCube_->numDates() << ")");
84
85 for (Size i = 0; i < tradeExposureCube_->numDates(); i++) {
86 QL_REQUIRE(tradeExposureCube_->dates()[i] == nettingSetExposureCube_->dates()[i],
87 "date at " << i << " in tradeExposureCube and nettingSetExposureCube mismatch ("
88 << tradeExposureCube_->dates()[i] << " vs " << nettingSetExposureCube_->dates()[i] << ")");
89 }
90
91 QL_REQUIRE(tradeEpeIndex < tradeExposureCube_->depth(), "tradeEpeIndex("
92 << tradeEpeIndex << ") exceeds depth of tradeExposureCube("
93 << tradeExposureCube_->depth() << ")");
94
95 QL_REQUIRE(tradeEneIndex < tradeExposureCube_->depth(), "tradeEneIndex("
96 << tradeEneIndex << ") exceeds depth of tradeExposureCube("
97 << tradeExposureCube_->depth() << ")");
98
99 QL_REQUIRE(nettingSetEpeIndex < nettingSetExposureCube_->depth(), "nettingSetEpeIndex("
100 << nettingSetEpeIndex << ") exceeds depth of nettingSetExposureCube("
101 << nettingSetExposureCube_->depth() << ")");
102
103 QL_REQUIRE(nettingSetEneIndex < nettingSetExposureCube_->depth(), "nettingSetEneIndex("
104 << nettingSetEneIndex << ") exceeds depth of nettingSetExposureCube("
105 << nettingSetExposureCube_->depth() << ")");
106
107}
108
109const map<string, Real>& ValueAdjustmentCalculator::tradeCva() {
110 return tradeCva_;
111}
112
113const map<string, Real>& ValueAdjustmentCalculator::tradeDva() {
114 return tradeDva_;
115}
116
118 return nettingSetCva_;
119}
120
122 return nettingSetDva_;
123}
124
126 return nettingSetSumCva_;
127}
128
130 return nettingSetSumDva_;
131}
132
133const Real& ValueAdjustmentCalculator::tradeCva(const std::string& trade) {
134 if (tradeCva_.find(trade) != tradeCva_.end())
135 return tradeCva_[trade];
136 else
137 QL_FAIL("trade " << trade << " not found in expected CVA results");
138}
139
140const Real& ValueAdjustmentCalculator::tradeDva(const std::string& trade) {
141 if (tradeDva_.find(trade) != tradeDva_.end())
142 return tradeDva_[trade];
143 else
144 QL_FAIL("trade " << trade << " not found in expected DVA results");
145}
146
147const Real& ValueAdjustmentCalculator::tradeFba(const std::string& trade) {
148 if (tradeFba_.find(trade) != tradeFba_.end())
149 return tradeFba_[trade];
150 else
151 QL_FAIL("trade " << trade << " not found in expected FBA results");
152}
153
154const Real& ValueAdjustmentCalculator::tradeFba_exOwnSp(const std::string& trade) {
155 if (tradeFba_exOwnSp_.find(trade) != tradeFba_exOwnSp_.end())
156 return tradeFba_exOwnSp_[trade];
157 else
158 QL_FAIL("trade " << trade << " not found in expected FBA ex own sp results");
159}
160
161const Real& ValueAdjustmentCalculator::tradeFba_exAllSp(const std::string& trade) {
162 if (tradeFba_exAllSp_.find(trade) != tradeFba_exAllSp_.end())
163 return tradeFba_exAllSp_[trade];
164 else
165 QL_FAIL("trade " << trade << " not found in expected FBA ex all sp results");
166}
167
168const Real& ValueAdjustmentCalculator::tradeFca(const std::string& trade) {
169 if (tradeFca_.find(trade) != tradeFca_.end())
170 return tradeFca_[trade];
171 else
172 QL_FAIL("trade " << trade << " not found in expected FCA results");
173}
174
175const Real& ValueAdjustmentCalculator::tradeFca_exOwnSp(const std::string& trade) {
176 if (tradeFca_exOwnSp_.find(trade) != tradeFca_exOwnSp_.end())
177 return tradeFca_exOwnSp_[trade];
178 else
179 QL_FAIL("trade " << trade << " not found in expected FCA ex own sp results");
180}
181
182const Real& ValueAdjustmentCalculator::tradeFca_exAllSp(const std::string& trade) {
183 if (tradeFca_exAllSp_.find(trade) != tradeFca_exAllSp_.end())
184 return tradeFca_exAllSp_[trade];
185 else
186 QL_FAIL("trade " << trade << " not found in expected FCA ex all sp results");
187}
188
189const Real& ValueAdjustmentCalculator::tradeMva(const std::string& trade) {
190 if (tradeMva_.find(trade) != tradeMva_.end())
191 return tradeMva_[trade];
192 else
193 QL_FAIL("trade " << trade << " not found in expected MVA results");
194}
195
196const Real& ValueAdjustmentCalculator::nettingSetSumCva(const std::string& nettingSet) {
197 if (nettingSetSumCva_.find(nettingSet) != nettingSetSumCva_.end())
198 return nettingSetSumCva_[nettingSet];
199 else
200 QL_FAIL("netting set " << nettingSet << " not found in expected CVA results");
201}
202
203const Real& ValueAdjustmentCalculator::nettingSetSumDva(const std::string& nettingSet) {
204 if (nettingSetSumDva_.find(nettingSet) != nettingSetSumDva_.end())
205 return nettingSetSumDva_[nettingSet];
206 else
207 QL_FAIL("netting set " << nettingSet << " not found in expected DVA results");
208}
209
210const Real& ValueAdjustmentCalculator::nettingSetCva(const std::string& nettingSet) {
211 if (nettingSetCva_.find(nettingSet) != nettingSetCva_.end())
212 return nettingSetCva_[nettingSet];
213 else
214 QL_FAIL("netting set " << nettingSet << " not found in expected CVA results");
215}
216
217const Real& ValueAdjustmentCalculator::nettingSetDva(const std::string& nettingSet) {
218 if (nettingSetDva_.find(nettingSet) != nettingSetDva_.end())
219 return nettingSetDva_[nettingSet];
220 else
221 QL_FAIL("netting set " << nettingSet << " not found in expected DVA results");
222}
223
224const Real& ValueAdjustmentCalculator::nettingSetFba(const std::string& nettingSet) {
225 if (nettingSetFba_.find(nettingSet) != nettingSetFba_.end())
226 return nettingSetFba_[nettingSet];
227 else
228 QL_FAIL("netting set " << nettingSet << " not found in expected FBA results");
229}
230
231const Real& ValueAdjustmentCalculator::nettingSetFba_exOwnSp(const std::string& nettingSet) {
232 if (nettingSetFba_exOwnSp_.find(nettingSet) != nettingSetFba_exOwnSp_.end())
233 return nettingSetFba_exOwnSp_[nettingSet];
234 else
235 QL_FAIL("netting set " << nettingSet << " not found in expected FBA ex own sp results");
236}
237
238const Real& ValueAdjustmentCalculator::nettingSetFba_exAllSp(const std::string& nettingSet) {
239 if (nettingSetFba_exAllSp_.find(nettingSet) != nettingSetFba_exAllSp_.end())
240 return nettingSetFba_exAllSp_[nettingSet];
241 else
242 QL_FAIL("netting set " << nettingSet << " not found in expected FBA ex all sp results");
243}
244
245const Real& ValueAdjustmentCalculator::nettingSetFca(const std::string& nettingSet) {
246 if (nettingSetFca_.find(nettingSet) != nettingSetFca_.end())
247 return nettingSetFca_[nettingSet];
248 else
249 QL_FAIL("netting set " << nettingSet << " not found in expected FBA results");
250}
251
252const Real& ValueAdjustmentCalculator::nettingSetFca_exOwnSp(const std::string& nettingSet) {
253 if (nettingSetFca_exOwnSp_.find(nettingSet) != nettingSetFca_exOwnSp_.end())
254 return nettingSetFca_exOwnSp_[nettingSet];
255 else
256 QL_FAIL("netting set " << nettingSet << " not found in expected FBA ex own sp results");
257}
258
259const Real& ValueAdjustmentCalculator::nettingSetFca_exAllSp(const std::string& nettingSet) {
260 if (nettingSetFca_exAllSp_.find(nettingSet) != nettingSetFca_exAllSp_.end())
261 return nettingSetFca_exAllSp_[nettingSet];
262 else
263 QL_FAIL("netting set " << nettingSet << " not found in expected FBA ex all sp results");
264}
265
266const Real& ValueAdjustmentCalculator::nettingSetMva(const std::string& nettingSet) {
267 if (nettingSetMva_.find(nettingSet) != nettingSetMva_.end())
268 return nettingSetMva_[nettingSet];
269 else
270 QL_FAIL("netting set " << nettingSet << " not found in expected MVA results");
271}
272
274 const auto& numDates = dates().size();
275 const auto& today = asof();
276
277 Handle<YieldTermStructure> borrowingCurve, lendingCurve, oisCurve;
278 if (baseCurrency_ != "")
279 oisCurve = market_->discountCurve(baseCurrency_, configuration_);
280
281 string origDvaName = dvaName_;
282 // Trade XVA
283 for (const auto& [tid, trade] : portfolio_->trades()) {
284 try {
285 LOG("Update XVA for trade " << tid
286 << (flipViewXVA_ ? ", inverted (flipViewXVA = Y)"
287 : ", regular (flipViewXVA = N)"));
288 string cid;
289 if (flipViewXVA_) {
290 cid = origDvaName;
291 dvaName_ = trade->envelope().counterparty();
294 } else {
295 cid = trade->envelope().counterparty();
296 }
297 if (fvaBorrowingCurve_ != "")
298 borrowingCurve = market_->yieldCurve(fvaBorrowingCurve_, configuration_);
299 if (fvaLendingCurve_ != "")
300 lendingCurve = market_->yieldCurve(fvaLendingCurve_, configuration_);
301
302 if (!borrowingCurve.empty() || !lendingCurve.empty()) {
303 QL_REQUIRE(baseCurrency_ != "", "baseCurrency required for FVA calculation");
304 }
305 string nid = trade->envelope().nettingSetId();
306 Real cvaRR = market_->recoveryRate(cid, configuration_)->value();
307 Real dvaRR = 0.0;
308 if (dvaName_ != "")
309 dvaRR = market_->recoveryRate(dvaName_, configuration_)->value();
310
311 tradeCva_[tid] = 0.0;
312 tradeDva_[tid] = 0.0;
313 tradeFca_[tid] = 0.0;
314 tradeFca_exOwnSp_[tid] = 0.0;
315 tradeFca_exAllSp_[tid] = 0.0;
316 tradeFba_[tid] = 0.0;
317 tradeFba_exOwnSp_[tid] = 0.0;
318 tradeFba_exAllSp_[tid] = 0.0;
319 tradeMva_[tid] = 0.0;
320 for (Size j = 0; j < numDates; ++j) {
321
322 // CVA / DVA
323 Date d0 = j == 0 ? today : dates()[j - 1];
324 Date d1 = dates()[j];
325 Real cvaIncrement = calculateCvaIncrement(tid, cid, d0, d1, cvaRR);
326 Real dvaIncrement = dvaName_ != "" ? calculateDvaIncrement(tid, d0, d1, dvaRR) : 0;
327 tradeCva_[tid] += cvaIncrement;
328 tradeDva_[tid] += dvaIncrement;
329
330 // FCA
331 if (!borrowingCurve.empty()) {
332 Real dcf = borrowingCurve->discount(d0) / borrowingCurve->discount(d1) -
333 oisCurve->discount(d0) / oisCurve->discount(d1);
334 Real fcaIncrement = calculateFcaIncrement(tid, cid, dvaName_, d0, d1, dcf);
335 Real fcaIncrement_exOwnSP = calculateFcaIncrement(tid, cid, "", d0, d1, dcf);
336 Real fcaIncrement_exAllSP = calculateFcaIncrement(tid, "", "", d0, d1, dcf);
337 tradeFca_[tid] += fcaIncrement;
338 tradeFca_exOwnSp_[tid] += fcaIncrement_exOwnSP;
339 tradeFca_exAllSp_[tid] += fcaIncrement_exAllSP;
340 }
341
342 // FBA
343 if (!lendingCurve.empty()) {
344 Real dcf = lendingCurve->discount(d0) / lendingCurve->discount(d1) -
345 oisCurve->discount(d0) / oisCurve->discount(d1);
346 Real fbaIncrement = calculateFbaIncrement(tid, cid, dvaName_, d0, d1, dcf);
347 Real fbaIncrement_exOwnSP = calculateFbaIncrement(tid, cid, "", d0, d1, dcf);
348 Real fbaIncrement_exAllSP = calculateFbaIncrement(tid, "", "", d0, d1, dcf);
349 tradeFba_[tid] += fbaIncrement;
350 tradeFba_exOwnSp_[tid] += fbaIncrement_exOwnSP;
351 tradeFba_exAllSp_[tid] += fbaIncrement_exAllSP;
352 }
353 }
354 if (nettingSetSumCva_.find(nid) == nettingSetSumCva_.end()) {
355 nettingSetSumCva_[nid] = 0.0;
356 nettingSetSumDva_[nid] = 0.0;
357 }
358 nettingSetSumCva_[nid] += tradeCva_[tid];
359 nettingSetSumDva_[nid] += tradeDva_[tid];
360 } catch (const std::exception& e) {
361 StructuredAnalyticsErrorMessage("ValueAdjustmentCalculator", "Error processing trade.", e.what(),
362 {{"tradeId", tid}})
363 .log();
364 }
365 }
366
367 // Netting Set XVA
368 for (const auto& pair : nettingSetCpty_) {
369 string nid = pair.first;
370 LOG("Update XVA for netting set "
371 << nid << (flipViewXVA_ ? ", inverted (flipViewXVA = Y)" : ", regular (flipViewXVA = N)"));
372 try {
373 string cid;
374 if (flipViewXVA_) {
375 cid = origDvaName;
376 dvaName_ = pair.second;
377 fvaBorrowingCurve_ = dvaName_ + flipViewBorrowingCurvePostfix_;
378 fvaLendingCurve_ = dvaName_ + flipViewLendingCurvePostfix_;
379 } else {
380 cid = pair.second;
381 }
382 Real cvaRR = market_->recoveryRate(cid, configuration_)->value();
383 Real dvaRR = 0.0;
384 if (dvaName_ != "") {
385 dvaRR = market_->recoveryRate(dvaName_, configuration_)->value();
386 }
387 if (fvaBorrowingCurve_ != "")
388 borrowingCurve = market_->yieldCurve(fvaBorrowingCurve_, configuration_);
389 if (fvaLendingCurve_ != "")
390 lendingCurve = market_->yieldCurve(fvaLendingCurve_, configuration_);
391
392 if (!borrowingCurve.empty() || !lendingCurve.empty()) {
393 QL_REQUIRE(baseCurrency_ != "", "baseCurrency required for FVA calculation");
394 }
395
396 nettingSetCva_[nid] = 0.0;
397 nettingSetDva_[nid] = 0.0;
398 nettingSetFca_[nid] = 0.0;
399 nettingSetFca_exOwnSp_[nid] = 0.0;
400 nettingSetFca_exAllSp_[nid] = 0.0;
401 nettingSetFba_[nid] = 0.0;
402 nettingSetFba_exOwnSp_[nid] = 0.0;
403 nettingSetFba_exAllSp_[nid] = 0.0;
404 nettingSetMva_[nid] = 0.0;
405 for (Size j = 0; j < numDates; ++j) {
406 // CVA / DVA
407 Date d0 = j == 0 ? today : dates()[j - 1];
408 Date d1 = dates()[j];
409 Real cvaIncrement = calculateNettingSetCvaIncrement(nid, cid, d0, d1, cvaRR);
410 Real dvaIncrement = dvaName_ != "" ? calculateNettingSetDvaIncrement(nid, d0, d1, dvaRR) : 0;
411 nettingSetCva_[nid] += cvaIncrement;
412 nettingSetDva_[nid] += dvaIncrement;
413
414 // FCA
415 if (!borrowingCurve.empty()) {
416 Real dcf = borrowingCurve->discount(d0) / borrowingCurve->discount(d1) -
417 oisCurve->discount(d0) / oisCurve->discount(d1);
418 Real fcaIncrement = calculateNettingSetFcaIncrement(nid, cid, dvaName_, d0, d1, dcf);
419 Real fcaIncrement_exOwnSP = calculateNettingSetFcaIncrement(nid, cid, "", d0, d1, dcf);
420 Real fcaIncrement_exAllSP = calculateNettingSetFcaIncrement(nid, "", "", d0, d1, dcf);
421 nettingSetFca_[nid] += fcaIncrement;
422 nettingSetFca_exOwnSp_[nid] += fcaIncrement_exOwnSP;
423 nettingSetFca_exAllSp_[nid] += fcaIncrement_exAllSP;
424
425 // MVA
426 if (dimCalculator_) {
427 Real mvaIncrement = calculateNettingSetMvaIncrement(nid, cid, d0, d1, dcf);
428 nettingSetMva_[nid] += mvaIncrement;
429 }
430 }
431
432 // FBA
433 if (!lendingCurve.empty()) {
434 Real dcf = lendingCurve->discount(d0) / lendingCurve->discount(d1) -
435 oisCurve->discount(d0) / oisCurve->discount(d1);
436 Real fbaIncrement = calculateNettingSetFbaIncrement(nid, cid, dvaName_, d0, d1, dcf);
437 Real fbaIncrement_exOwnSP = calculateNettingSetFbaIncrement(nid, cid, "", d0, d1, dcf);
438 Real fbaIncrement_exAllSP = calculateNettingSetFbaIncrement(nid, "", "", d0, d1, dcf);
439 nettingSetFba_[nid] += fbaIncrement;
440 nettingSetFba_exOwnSp_[nid] += fbaIncrement_exOwnSP;
441 nettingSetFba_exAllSp_[nid] += fbaIncrement_exAllSP;
442 }
443 }
444 } catch (const std::exception& e) {
445 StructuredAnalyticsErrorMessage("ValueAdjustmentCalculator", "Error processing netting set.", e.what(),
446 {{"nettingSetId", nid}})
447 .log();
448 }
449 }
450}
451
452} // namespace analytics
453} // namespace ore
const map< string, Real > & nettingSetSumDva()
Sum DVA map for all the netting sets.
const Real & tradeFca(const string &trade)
FCA for the specified trade.
QuantLib::ext::shared_ptr< Market > market_
const Real & tradeFca_exAllSp(const string &trade)
FCA (excl all survival probability) for the specified trade.
const map< string, Real > & tradeDva()
DVA map for all the trades.
const Real & tradeFba_exOwnSp(const string &trade)
FBA (excl own survival probability) for the specified trade.
const Real & nettingSetFba_exOwnSp(const string &nettingSet)
FBA (excl own survival probability) for the specified netting set.
virtual const Real calculateFcaIncrement(const string &tid, const string &cid, const string &dvaName, const Date &d0, const Date &d1, const Real &dcf)=0
const Real & tradeFba(const string &trade)
FBA for the specified trade.
virtual const Real calculateDvaIncrement(const string &tid, const Date &d0, const Date &d1, const Real &rr)=0
const Real & nettingSetFba_exAllSp(const string &nettingSet)
FBA (excl all survival probability) for the specified netting set.
virtual void build()
Compute cva along all paths and fill result structures.
const Real & nettingSetFca(const string &nettingSet)
FCA for the specified netting set.
virtual const Real calculateFbaIncrement(const string &tid, const string &cid, const string &dvaName, const Date &d0, const Date &d1, const Real &dcf)=0
virtual const vector< Date > & dates()
const map< string, Real > & tradeCva()
CVA map for all the trades.
const Real & nettingSetFca_exOwnSp(const string &nettingSet)
FCA (excl own survival probability) for the specified netting set.
QuantLib::ext::shared_ptr< Portfolio > portfolio_
const map< string, Real > & nettingSetDva()
DVA map for all the netting sets.
const map< string, Real > & nettingSetSumCva()
Sum CVA map for all the netting sets.
const Real & tradeMva(const string &trade)
MVA for the specified trade.
virtual const Real calculateCvaIncrement(const string &tid, const string &cid, const Date &d0, const Date &d1, const Real &rr)=0
const Real & nettingSetFba(const string &nettingSet)
FBA for the specified netting set.
const QuantLib::ext::shared_ptr< NPVCube > nettingSetExposureCube_
const map< string, Real > & nettingSetCva()
CVA map for all the netting sets.
const Real & nettingSetFca_exAllSp(const string &nettingSet)
FCA (excl all survival probability) for the specified netting set.
ValueAdjustmentCalculator(const QuantLib::ext::shared_ptr< Portfolio > portfolio, const QuantLib::ext::shared_ptr< Market > market, const string &configuration, const string &baseCurrency, const string &dvaName, const string &fvaBorrowingCurve, const string &fvaLendingCurve, const bool applyDynamicInitialMargin, const QuantLib::ext::shared_ptr< DynamicInitialMarginCalculator > dimCalculator, const QuantLib::ext::shared_ptr< NPVCube > tradeExposureCube, const QuantLib::ext::shared_ptr< NPVCube > nettingSetExposureCube, const Size tradeEpeIndex=0, const Size tradeEneIndex=1, const Size nettingSetEpeIndex=1, const Size nettingSetEneIndex=2, const bool flipViewXVA=false, const string &flipViewBorrowingCurvePostfix="_BORROW", const string &flipViewLendingCurvePostfix="_LEND")
const Real & tradeFba_exAllSp(const string &trade)
FBA (excl all survival probability) for the specified trade.
const Real & tradeFca_exOwnSp(const string &trade)
FCA (excl own survival probability) for the specified trade.
const QuantLib::ext::shared_ptr< NPVCube > tradeExposureCube_
const Real & nettingSetMva(const string &nettingSet)
MVA for the specified netting set.
#define LOG(text)
RandomVariable log(RandomVariable x)
Structured analytics error.
CVA calculator base class.