To use the models and valuations in the previous sections, a Calculation object needs to be constructed and correctly setup. Note that all calculations need a calc_name field as a description.

## Base_Revaluation

This applies the valuation models mentioned earlier to the portfolio per deal.

The only inputs are:

• Currency of the output.
• Run_Date at which the marketdata should be applied (i.e. $t_0$)

The output is a dictionary containing the DealStructure and the calculation computation statistics.

## Credit_Monte_Carlo

A profile is a curve $V(t)$ with values specified at a discrete set of future dates $0=t_0 with values at other dates obtained via linear interpolation or zero extrapolation i.e. if $t_{i-1} then $V(t)$ is a linear interpolation of $V(t_{i-1})$ and $V(t_i)$; otherwise $V(t)=0$.

The valuation models described earlier are used to construct the profile. The profile dates $t_1,...,t_m$ are obtained by taking the following union:

• The deal's maturity date.
• The dates in the Base Time Grid up the the deal's maturity date.
• Deal specific dates such as payment and exercise dates.

Deal specific dates improve the accuracy of the profile by showing the effect of cashflows, exercises etc.

### Aggregation

If $U$ and $V$ are profiles, then the set $U+V$ is the union of profile dates $U$ and $V$. If $E$ is the credit exposure profile in reporting currency (Currency), then:

where $V_d$ is the valuation profile of the $d^{th}$ deal. Note that Netting is always assumed to be True.

#### Peak Exposure

This is the simulated exposure at percentile $q$ where $0 (typically q=.95 or .99).

#### Expected Exposure

This is the profile defined by taking the average of the positive simulated exposures i.e. for each profile date $t$,

#### Exposure Deflation

Exposure at time $t$ is simulated in units of the time $t$ reporting currency. Exposure deflation converts this to time $0$ reporting currency i.e.

where

This can be approximated by:

where $0=s_0<.... The discrete set of dates $s_1,...,s_{n-1}$ are model-dependent.

This represents the adjustment to the market value of the portfolio accounting for the risk of default. Only unilateral CVA (i.e accounting for the counterparty risk of default but ignoring the potential default of the investor) is calculated. It is given by:

where the expectation is taken with respect to the risk-neutral measure, and

with:

• $R$ the counterparty recovery rate
• $\tau$ the counterparty time to default
• $E^*(t)$ the exposure at time $t$ deflated by the money market account.

If Deflate Stochastically is No then the deflated expected exposure is assumed to be deterministic i.e. $E^*(t)=E(t)D(0,t)$. Note that if $T$ is the end date of the portfolio exposure then $E^*(t)=0$ for $t>T$.

Now,

where $h(t)$ is the stochastic hazard rate. There are two ways to calculate the expectation:

If Stochastic Hazard is No then $H(t)=\Bbb P(\tau > t)=S(0,t)$, the risk neutral survival probability to time $t$ and

with

and $0=t_0<... are the time points on the exposure profile. Note that the factor models used should be risk-neutral to give risk neutral simulations of $\Bbb E^*(t)$.

If Stochastic Hazard is Yes then $S(t,u)$ is the simulated survival probability at time $t$ for maturity $u$ and is related to $H$ by

where $\mathcal F$ is the filtration given by the risk factor processes. For small $u-t$, the approximation $H(u)\approx H(t)S(t,u)$ is accurate so that

and

again, $0=t_0<... are the time points on the exposure profile and

• $B_j(t)$ is the number of units of the collateral portfolio for scenario $j$ at time $t$
• $S_j(t)$ is the base currecy value of one unit of the collateral asset for scenario $j$ at time $t$
• $D_j^c(t)$ is the discount rate for the collateral rate at time t for scenario $j$
• $D_j^f(t)$ is the discount rate for the funding rate at time t for scenario $j$