Valuation Adjustment

torchquantlib.core.risk.valuation_adjustment.valuation_adjustment.calculate_cva(exposure: Tensor, default_prob: Tensor, recovery_rate: Tensor) Tensor[source]

Calculate the Credit Valuation Adjustment (CVA).

CVA represents the market value of counterparty credit risk.

Parameters:
  • exposure (Tensor) – Expected positive exposure to the counterparty.

  • default_prob (Tensor) – Probability of default of the counterparty.

  • recovery_rate (Tensor) – Expected recovery rate in case of default (between 0 and 1).

Returns:

The calculated Credit Valuation Adjustment.

Return type:

Tensor

torchquantlib.core.risk.valuation_adjustment.valuation_adjustment.calculate_dva(exposure: Tensor, default_prob: Tensor, recovery_rate: Tensor) Tensor[source]

Calculate the Debit Valuation Adjustment (DVA).

DVA is similar to CVA but represents the credit risk of the entity itself.

Parameters:
  • exposure (Tensor) – Expected negative exposure (i.e., liability) to the counterparty.

  • default_prob (Tensor) – Probability of default of the entity itself.

  • recovery_rate (Tensor) – Expected recovery rate in case of the entity’s default.

Returns:

The calculated Debit Valuation Adjustment.

Return type:

Tensor

torchquantlib.core.risk.valuation_adjustment.valuation_adjustment.calculate_fva(exposure: Tensor, funding_spread: Tensor, maturity: Tensor) Tensor[source]

Calculate the Funding Valuation Adjustment (FVA).

FVA represents the cost of funding for uncollateralized derivatives.

Parameters:
  • exposure (Tensor) – Expected exposure over the life of the derivative.

  • funding_spread (Tensor) – The entity’s funding spread above the risk-free rate.

  • maturity (Tensor) – Time to maturity of the derivative.

Returns:

The calculated Funding Valuation Adjustment.

Return type:

Tensor

torchquantlib.core.risk.valuation_adjustment.valuation_adjustment.calculate_mva(exposure: Tensor, funding_cost: Tensor, maturity: Tensor) Tensor[source]

Calculate the Margin Valuation Adjustment (MVA).

MVA represents the cost of posting initial margin for cleared or non-cleared derivatives.

Parameters:
  • exposure (Tensor) – Expected initial margin requirement.

  • funding_cost (Tensor) – The cost of funding the initial margin.

  • maturity (Tensor) – Time to maturity of the derivative.

Returns:

The calculated Margin Valuation Adjustment.

Return type:

Tensor