I am trying to help a friend with her thesis on Counterparty Credit Risk where she intends to have a somewhat lengthy treatment on Credit Valuation Adjustment (CVA). Specifically I am looking to help her in including some computer simulated experiments which would hopefully illustrate CVA calculations under simulated scenarios.

I have been reading a bit on CVA and have got somewhat fair idea of what's going on. However, I am at a loss to find a document where the "Math" has been distilled and computational aspects highlighted, preferably from a programmer's point of view. I have come across a document, which is part of MATLAB's financial toolbox and it does give me some ideas.

I am looking for suggestions/pointers regarding the same.

PS: I am not averse to understanding the Math, just quite perplexed about the "only Math" aspect.


3 Answers 3


There are good examples and spreadsheet solutions in John Gregory (2015). The maths is not complex. Computational aspects are step increments in time and simulation. Math will indicate computation ... ! A matter that requires more imagination is computational simulation on a portfolio basis (see Credit Valuation Adjustments -- computation issues).


If you can assume that credit is independent of any other factors that drive the future MTM of the reference portfolio (which can be a single trade only), all you need to do is

  1. generate paths of market factors, driving MTM of the portfolio, under the risk-neutral measure, and reprice the portfolio at each future point on each path; denote the sample vector of such values at time $t$ as $V(t)$

  2. compute expected exposure of your portfolio at each future time

$EE(t)=E(max(0, V(t)))$,

where V(t) is the value of the portfolio at time $t$

  1. Plug the $EE(t)$ curve into a CDS loss leg instead of the otherwise constant notional.

$CVA = (1-R)\int^T D(s)EE(s)dP(s)$,

where $D(s)$ is discount factor and $P(s)$ is default probability curve of the counterparty.


The hard part of the CVA computation stems from the default probabilities. There is a lot of literature on how to model credit events, but what was being used at global banks was in the ballpark of what was implemented by Duffie

  • $\begingroup$ You never model credit events explicitly for CVA $\endgroup$
    – achirikhin
    Commented May 27 at 22:55
  • $\begingroup$ the spirit of the default probability is to measure credit events... $\endgroup$
    – Yuca
    Commented Jun 2 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.