The Sortino Ratio is a financial metric used to assess the risk-adjusted performance of an investment portfolio or asset by considering only the downside risk. It measures the excess return generated by the portfolio per unit of downside risk, specifically, the standard deviation of negative returns. The Sortino Ratio is particularly useful for investors who are primarily concerned with minimizing the downside risk of their investments.

The formula is as follows:

\[\text{Sortino Ratio} = \text{Excess Return} / \text{Downside Deviation}\] \[\text{Downside Deviation} = \sqrt{(1 / N) \cdot \operatorname{SUM}(\min(\text{Excess Return},\; 0) ^{2})}\]

Where N is the total number of observations, not just the negative ones, following Sortino & Price (1994). By default one Sortino ratio is reported per period, computed from the daily excess returns falling inside that period. For a given period, for example monthly, this translates into the following:

\[\text{Sortino Ratio} = \text{Average Daily Excess Return within the Month} / \text{Downside Deviation of the Daily Excess Returns within the Month}\]

For a rolling period, period instead sets the frequency of the returns themselves and the ratio is computed over a rolling window of rolling such returns:

\[\text{Sortino Ratio} = \text{Average Rolling Excess Return} / \text{Rolling Downside Deviation}\]

Note that this is explicitly already subtracts the Risk Free Rate.

As with the Sharpe Ratio, the result is not annualized: it is a per-observation ratio, so multiply by SQRT(252), SQRT(52), SQRT(12) or SQRT(4) for daily, weekly, monthly or quarterly returns respectively before comparing against published annualized figures.

See definition: https://en.wikipedia.org/wiki/Sortino_ratio

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Sortino Ratio for you. Just ask in plain English.

Calculate the Sortino Ratio in Python

The Sortino Ratio is available in the Performance module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_sortino_ratio as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.performance.get_sortino_ratio()

Which returns:

Date AAPL TSLA
2021 0.197 0.2049
2022 -0.0675 -0.1069
2023 0.1839 0.1462
2024 0.1071 0.1044
2025 0.0283 0.0391
2026 0.0665 -0.0789

Parameters

get_sortino_ratio accepts the following parameters:

  • period (str, optional): The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
  • rolling (int, optional): The rolling window size to use for the calculation. If set, the Sortino ratio is calculated over a rolling window of this many periods across the full return history instead of per period. Defaults to None.
  • rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
  • lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.

The Performance module page introduces the module, and the sidebar lists all of its functions.

Share