> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# What are the exposure concepts?

> The financial concepts behind the framework: the gross-to-collateralized exposure waterfall, EE, ENE, PFE, ES, netting sets, break dates, and CSAs.

This page explains the financial and mathematical concepts behind the netting-set analytics framework. It covers the exposure waterfall from gross to netted to collateralized exposure, the exposure metrics (EE, ENE, PFE, ES), netting sets, break dates, and collateral. Understanding these concepts is a prerequisite before reading the developer-guide pages.

## What is counterparty exposure?

Counterparty exposure is the loss a party faces if a counterparty defaults and the trades between them have a positive net value at the time of default. The netting-set analytics framework computes exposure not as a single number but as a profile: a vector of values across future time points, and within each time point, a distribution across Monte-Carlo scenarios.

The raw input is the Mark-to-Future (MtF) table. Each row stores the simulated mark-to-market value of one trade at one future time point as a vector of doubles, one per scenario.

## What is the exposure waterfall?

The framework applies three successive transformations to raw MtF vectors. Each step reduces exposure by recognizing risk-mitigation agreements.

### Gross exposure

Gross exposure is the exposure of a single trade or a group of trades without any netting or collateral benefit. For the bank side, it is the positive part of the MtF sum at each scenario:

$E^{\text{gross}}_{\text{bank}}(t, s) = \max\bigl(\text{MtF sum}(t, s),\; 0\bigr)$

For the counterparty side, it is the negative part:

$E^{\text{gross}}_{\text{cpty}}(t, s) = \min\bigl(\text{MtF sum}(t, s),\; 0\bigr)$

The MtF sum at each time point is the element-wise sum of all individual trade MtF vectors.

### Netted exposure

When trades are covered by an ISDA master netting agreement, the positive and negative MtF values of different trades within the same netting set can offset each other. Netting reduces gross exposure to the net position of the netting set.

For the bank side, the netted exposure is:

$E^{\text{netted}}_{\text{bank}}(t, s) = \max\bigl(\text{NettingSet MtF sum}(t, s),\; 0\bigr)$

Trades without a netting agreement are treated as standalone netting sets. The netting set identifier defaults to a system-wide constant (`N/A`) for trades without an explicit agreement.

### Collateralized exposure

When a Credit Support Annex (CSA) is in place, collateral is exchanged based on the mark-to-market value of the netting set. The collateral balance is subtracted from the netted MtF value before taking the positive or negative part.

For the bank side:

$E^{\text{coll}}_{\text{bank}}(t, s) = \max\bigl(\text{NettingSet MtF}(t, s) - C(t, s),\; 0\bigr)$

For the counterparty side:

$E^{\text{coll}}_{\text{cpty}}(t, s) = \min\bigl(\text{NettingSet MtF}(t, s) - C(t, s),\; 0\bigr)$

where $C(t, s)$ is the collateral balance at time point $t$ under scenario $s$. The collateral balance is computed by a collateral algorithm. See [Collateral algorithms](../developer-guide/cube/collateral-evaluator-framework) for the balance calculation.

## What are the exposure metrics?

Exposure metrics are scalars derived from the scenario distribution of an exposure vector at a given time point.

### Expected Exposure (EE)

EE is the probability-weighted average of the positive exposure values across all scenarios at each time point. It measures the expected loss given default at that time point.

$\text{EE}(t) = \frac{1}{N}\sum_{s=1}^{N} E_{\text{bank}}(t, s)$

where $N$ is the total number of scenarios.

### Expected Negative Exposure (ENE)

ENE is the probability-weighted average of the negative (counterparty-side) exposure values. It drives the counterparty's perspective on the trade.

$\text{ENE}(t) = \frac{1}{N}\sum_{s=1}^{N} E_{\text{cpty}}(t, s)$

### Potential Future Exposure (PFE)

PFE is the quantile of the bank-side exposure distribution at a given confidence level $\alpha$. At confidence level 97.5%, PFE is the value that bank-side exposure exceeds in only 2.5% of scenarios.

$\text{PFE}_{\alpha}(t) = \text{Quantile}_{\alpha}\bigl(E_{\text{bank}}(t, 1), \ldots, E_{\text{bank}}(t, N)\bigr)$

The quantile position is $N \times (1 - \alpha/100)$, rounded with a configurable method and at least 1. See [Exposure metrics](../developer-guide/cube/exposure-metrics) for the rounding options.

### Expected Shortfall (ES)

ES is the average of the $K$ largest bank-side exposure values, where $K$ is the quantile position used for PFE. It represents the expected loss in the tail scenarios.

$\text{ES}_{\alpha}(t) = \frac{1}{|\mathcal{T}|}\sum_{s \in \mathcal{T}} E_{\text{bank}}(t, s)$

where $\mathcal{T}$ is the set of the $K$ scenarios with the largest bank-side exposure.

### PFE Scenario Index and PFE Scenario Name

PFE Scenario Index is the index of the scenario that produced the PFE value. PFE Scenario Name is the human-readable name of that scenario. These measures allow auditors to trace which Monte-Carlo path drove the worst-case exposure.

## What is a netting set?

A netting set is a group of trades covered by a single ISDA master agreement with a counterparty. When a counterparty defaults, the surviving party settles all trades in the netting set at their net mark-to-market value rather than cherry-picking favorable trades. This reduces credit exposure.

In the framework, netting sets are identified by the `NettingSetId` field on the `TradeAttributes` table. Trades with the default value (`N/A`) have no netting agreement and are treated individually.

## What is a break date?

A break date is a contractual date before the trade's legal maturity at which either party can terminate the trade. For exposure calculation purposes, a trade does not contribute to the exposure aggregate at time points beyond its break date.

The framework models this through the `BreakDate` field on `TradeAttributes` and the `Is Included In Break Date` dimension. When the break-date variant of a measure is selected, aggregation is limited to time points before each trade's break date.

## What is a CSA and why does it matter for exposure?

A Credit Support Annex (CSA) is the collateral agreement annexed to an ISDA master agreement. It defines the terms under which collateral is exchanged to reduce exposure. Key CSA parameters are:

* **Threshold.** The exposure level below which no collateral call is made. Below this level, no margin is exchanged.
* **Minimum Transfer Amount (MTA).** The smallest amount that triggers a collateral transfer. Prevents small daily adjustments.
* **Holding period (Margin Period of Risk).** The time lag between the last collateral exchange and when new collateral takes effect. Default: 20 days.
* **Independent Amount.** A fixed upfront collateral amount posted at trade inception, independent of mark-to-market movements.
* **Haircut Scale Factor.** A multiplier applied to exposure values. Default: 1.0.

The CSA can be bilateral (both parties post collateral based on exposure) or unilateral (only one party posts). The framework provides two built-in collateral algorithms for these cases. See [Collateral algorithms](../developer-guide/cube/collateral-evaluator-framework).

## Related pages

* [Collateral algorithms](../developer-guide/cube/collateral-evaluator-framework)
* [Exposure measures](../developer-guide/cube/exposure-measures)
* [Exposure metrics](../developer-guide/cube/exposure-metrics)
* [Enums reference](../reference/enums)
