sigmaquant.performance.risk.downside_risk#

sigmaquant.performance.risk.downside_risk(returns, frequency, m=0.0, annualize=True)#

Compute downside risk (semi-deviation).

Downside risk is defined as the square root of the mean squared negative deviations of returns below a threshold level m. Optionally, the estimator can be annualized using the square-root- of-time rule.

Parameters:
  • returns – Time series of periodic returns.

  • frequency – Frequency of the input data.

  • m – Threshold return. Only deviations below this level contribute to the downside risk.

  • annualize – If True, scale the semi-deviation to annual frequency using the square-root-of-time rule implied by frequency.

Returns:

Downside risk (semi-deviation). If annualize=True the value is scaled to annual frequency.

Return type:

float

Notes

  • NaN values are ignored.

Let \(r_t\) denote the periodic returns and \(m\) a threshold level.

The downside risk (semi-deviation) is defined as:

\[s_d = \sqrt{ \frac{1}{T} \sum_{t=1}^{T} \min(r_t - m, 0)^2 }\]

If annualize=True the estimator is scaled as:

\[s_{d,ann} = s_d \sqrt{N}\]

where \(N\) is the number of periods per year implied by frequency.