sigmaquant.performance.metrics.sortino_ratio#

sigmaquant.performance.metrics.sortino_ratio(returns, frequency, annualize=True, mar=0.0)#

Compute the Sortino ratio.

The Sortino ratio measures the excess return relative to a minimum acceptable return (MAR), adjusted for downside risk only.

Parameters:
  • returns – Sequence of periodic returns.

  • frequency

    Frequency of the returns:
    • ”D”: daily

    • ”W”: weekly

    • ”M”: monthly

    • ”Y”: yearly

  • annualize – If True, the Sortino ratio is scaled to annual frequency.

  • mar – Minimum acceptable return. This value is used consistently both in the numerator and in the downside risk computation.

Returns:

Sortino ratio.

Return type:

float

Notes

  • Missing values (NaN) are excluded from the computation.

  • The result is annualized using the square-root-of-time rule when annualize=True.

  • Risk-free rate is ignored unless explicitly used as MAR.

Let \(r_t\) denote the periodic returns and \(MAR\) the minimum acceptable return.

Define the sample mean excess return as:

\[\bar{r}_{MAR} = \frac{1}{T} \sum_{t=1}^{T} (r_t - MAR)\]

Define the downside deviation as:

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

The Sortino ratio estimator is:

\[\widehat{\text{Sortino}} = \frac{\bar{r}_{MAR}}{s_d}\]

If annualize=True:

\[\widehat{\text{Sortino}}_{ann} = \sqrt{N} \frac{\bar{r}_{MAR}}{s_d}\]

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