condValueAtRisk#

swordfish.function.condValueAtRisk()#

Calculate Conditional Value at Risk (CVaR), or expected shortfall (ES) to estimate the average losses incurred beyond the VaR level.

Parameters:
  • returns (Constant) – A numeric vector representing the returns. The element must be greater than -1 and cannot be empty.

  • method (Constant) –

    A string indicating the CVaR calculation method, which can be:

    • ’normal’: parametric method with normal distribution

    • ’logNormal’: parametric method with log-normal distribution

    • ’historical’: historical method

    • ’monteCarlo’: Monte Carlo simulation

  • confidenceLevel (Constant, optional) – A numeric scalar representing the confidence level, with a valid range of (0,1). The default value is 0.95.

Returns:

A DOUBLE value indicating the absolute value of the average losses that exceed the VaR. The value of VaR is returned if there is no return beyond the level.

Return type:

Constant