Message Boards Message Boards

3
|
16002 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Efficient computation of the Credit Valuation Adjustment

Posted 10 years ago

Credit Valuation Adjustment – also known as CVA - is closely followed regulatory measure that provides the method for the OTC derivative contract valuation correction due to a counterparty default. In this way, CVA can be seen as a provision to be held against a derivative transaction in the event of default. Computationally, CVA is a logical extension of the exposure method presented in the previous documents. Here we present a Monte Carlo numerical CVA approach with a dependent swap rate - hazard rate process and demonstrate why Mathematica 10 is ideally suited for this task.

CVA chart

Attachments:
POSTED BY: Igor Hlivka
3 Replies

Dear Igor, thanks a lot for sharing the code. Now everything works fine. Regards, Ruben

Hello Ruben

Here is the code that should be working - it runs on my side....

In[1]:= cW[\[Rho]_] := 
  Refine[ItoProcess[{{0, 0}, IdentityMatrix[2]}, {{n1, n2}, {0, 0}}, 
    t, {{1, \[Rho]}, {\[Rho], 1}}], -1 < \[Rho] < 1];

In[2]:= combprc = 
  ItoProcess[{\[DifferentialD]s[
       t] == \[Mu] s[t] \[DifferentialD]t + \[Sigma]1*
       s[t] \[DifferentialD]n1[t], \[DifferentialD]c[
       t] == \[Theta] (\[Beta] - c[t]) \[DifferentialD]t + \[Sigma]2*
       Sqrt[Abs[c[t]]] \[DifferentialD]n2[t]
    }, {s[t], c[t]}, {{s, c}, {s0, c0}}, 
   t, {n1, n2} \[Distributed] cW[\[Rho]]];

In[3]:= {dt, y, R} = {0.005, 5, 0.4};

In[4]:= simproc = 
  RandomFunction[
   combprc /. {\[Mu] -> 0.022, \[Sigma]1 -> 0.2, \[Theta] -> 
      0.005, \[Beta] -> 0.015, \[Sigma]2 -> 0.05, \[Rho] -> 0.5, 
     s0 -> 0.025, c0 -> 0.0125}, {0, y, dt}, 1000, 
   Method -> "StochasticRungeKutta"] ;

In[5]:= swapproc = simproc["PathComponent", 1];
cdsproc = simproc["PathComponent", 2];
hazrate = TimeSeriesMap[#/(1 - R) &, cdsproc];
ListLinePlot[swapproc["Path", Range[10]], 
 PlotLabel -> "Swap rate process"]
ListLinePlot[hazrate["Path", Range[15]], 
 PlotLabel -> "Hazard rate process", PlotRange -> All]

If it does not, please let me know.

Kind regards Igor

POSTED BY: Igor Hlivka
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract