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. )

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

## Credit_Monte_Carlo

A profile is a curve with values specified at a discrete set of future dates with values at other dates obtained via linear interpolation or zero extrapolation i.e. if then is a linear interpolation of and ; otherwise .

The valuation models described earlier are used to construct the profile. The profile dates 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 and are profiles, then the set is the union of profile dates and . If is the
credit exposure profile in reporting
currency (**Currency**), then:

where is the valuation profile of the deal. Note that Netting is always assumed to be
**True**.

#### Peak Exposure

This is the simulated exposure at percentile where (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 ,

#### Exposure Deflation

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

where

This can be approximated by:

where . The discrete set of dates are model-dependent.

### Credit Valuation Adjustment

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:

- the counterparty recovery rate
- the counterparty time to default
- the exposure at time deflated by the money market account.

If **Deflate Stochastically** is **No** then the deflated expected exposure is assumed to be deterministic
i.e. . Note that if is the end date of the portfolio exposure then for
.

Now,

where is the stochastic hazard rate. There are two ways to calculate the expectation:

If **Stochastic Hazard** is **No** then , the risk neutral survival
probability to time and

with

and are the time points on the exposure profile. Note that the factor models used should be risk-neutral to give risk neutral simulations of .

If **Stochastic Hazard** is **Yes** then is the simulated survival probability at time for
maturity and is related to by

where is the filtration given by the risk factor processes. For small , the approximation is accurate so that

and

again, are the time points on the exposure profile and

### Funding Valuation Adjustment

Posting (or recieving) collateral can imply a funding cost (or benefit) when there is a spread between a party's interal cost of funding and the contractual interest rate paid on the collateral balance. The discounted expectation of this cost (or benefit) summed across all time horizons and scenarios constitutes a funding value adjustment and can be expressed as:

where

- is the number of units of the collateral portfolio for scenario at time
- is the base currecy value of one unit of the collateral asset for scenario at time
- is the discount rate for the collateral rate at time t for scenario
- is the discount rate for the funding rate at time t for scenario

Note that only cash collateral is supported presently although this can be extended.