# Calculating counterparty exposure

Any OTC financial transaction bears counterparty risk: the risk that the counterparty defaults and becomes unable to fulfill its financial obligations.

Suppose we have a derivative contract (e.g. interest rate swap) with counterparty X. To assess our losses from the default of X, let us assume that if X defaults, we close out our position with X and enter a similar swap with another counterparty. Then, our losses will depend on the mark-to-market (MtM) value of the swap at the moment of default.

If the swap is out of the money for us, then we lose nothing: we close out the swap with X (paying the MtM to X), and enter an equivalent swap, receiving the MtM from the new counterparty. If the swap was in the money for us, we incur losses: we close out the swap with X (but X pays us nothing because they are in default), and enter an equivalent swap, where we are required to pay the current MtM to the new counterparty.

We need to keep a cash reserve to cover our losses from counterparty default. How much do we need to reserve? For example, if we have a vanilla 6 year swap with X, how much can we lose if X defaults? The MtM of a swap changes in time, depending on the interest rates. We cannot predict interest rates in the future, but we can calculate, with a certain confidence, the upper bound of our losses: our exposure to X. For instance, if we say that our potential exposure to X at 95% confidence is 100 euros, it means that if X defaults, then with 95% probability our loss will not exceed 100 euros.

Below is the exposure profile calculated by MarketSimulator for an 6 year receiver swap. The x axis is the time of default, the y axis is the potential exposure to X at 95% confidence. Interest rates were simulated with a 3-factor exponential Vasicek model calibrated to historical data. Notice the sharp drops in the exposure every half year: they correspond to coupon payments. Each time a coupon is payed, the exposure decreases because there are fewer outstanding payments.

The exposure profile gives us a clear picture of the potential losses. This is useful for calculating capital reserves as well as checking exposure limits for the counterparty.