Performance Metrics: The Sharpe Ratio and the Sortino Ratio

For a systematic trader, effectively managing risk in a trading system is crucial to the long-term viability of the system. The most obvious performance metric for testing a strategy is its profitability— we all want a winning system. But alone, the historical returns of a strategy don’t provide enough information. For example, say you are trying to decide between two strategies with historical returns of 7% and 5%, respectively. Which would you choose? Without any other information, the easy answer is the first strategy because it has a higher historical return. However, what if you then found out the first strategy had a drawdown of 50% while the second strategy had a drawdown of 20%? Knowing this, your answer may change.

The Sharpe Ratio

One way to measure  a strategy’s risk compared to its reward is to calculate its Sharpe Ratio. Initially termed the reward-to-variability ratio by its namesake William F. Sharpe 1, the Sharpe Ratio indicates the average return per unit of risk in excess of the risk-free rate of return. A high Sharpe Ratio is generally more attractive because it indicates a higher risk-adjusted return. The Sharpe Ratio can be calculated using the following formula 2:

Sharpe Ratio = (r – rf) / σ, where:

r = expected return of strategy x
r= risk-free rate of return
σ = standard deviation of expected return of strategy x

Generally speaking, higher values are considered ‘good’ and low or negative values are considered ‘bad’. A high Sharpe Ratio indicates the strategy produces returns in excess of the risk-free rate, while a negative number indicates the strategy can be expected to perform worse than a risk-free investment, or if the risk-free rate is 0, is expected to produce negative returns. What is considered high or low may vary considerably by asset class and market conditions, so the Sharpe Ratio is often used as a comparative measure between two or more strategies.

While this metric can help evaluate risk when building and testing a trading system, the Sharpe ratio is not perfect. For one, it assumes returns are normally distributed and does not account for skew or kurtosis which may occur in a real market scenario. Additionally it is a measure of historical performance and therefore assumes that future market conditions would be similar to past conditions which we know is not always the case.

The Sharpe Ratio calculates the return per unit of risk, using standard deviation as the risk measure. However, because standard deviation is agnostic when it comes to direction, large positive returns will increase the standard deviation the same way as large negative returns. This can make the Sharpe Ratio misleading when comparing strategies with asymmetric distributions, i.e. a strategy where most of the volatility is positive vs. a strategy with volatility in both directions. Because higher standard deviations will “penalize” a strategy in the context of a Sharpe Ratio, this is an important consideration.

The Sortino Ratio

An investor may not wish to “penalize” a strategy for positive volatility. The Sortino Ratio attempts to correct for this by considering the standard deviation of negative returns, thus only penalizing the strategy for negative volatility/outcomes.

The calculation of downside volatility is a topic of some debate 3. By definition, standard deviation measures the dispersion of data around its mean. The typical standard deviation definition, when applied to only downside returns, measures dispersion around the average downside return. However, it can be more meaningful to modify the calculation of downside deviation so that it measures dispersion around a different target, like 0; in this way, we measure each return’s “distance” from 0 instead of from the average negative return.

This is the idea behind the research note from Rollinger and Hoffman (2013). In this note, Rollinger and Hoffman explain a calculation for the downside deviation measures which the dispersion of data below a selected center 4. Because volatility to the upside means profits, a trader may be happy to accept positive volatility and measure only negative volatility. The downside deviation allows for this by isolating only returns below the target return of the strategy. The formula is below:

Sortino Ratio = (r – rf ) / σd, where:

r = expected return of strategy x
r= risk-free rate of return
σ= downside deviation of expected return of strategy x

As with the Sharpe Ratio, the Sortino Ratio is most helpful when it is compared to that of another strategy or system. However it is important to use a constant target return in the calculation when comparing Sortino Ratios to get an accurate comparison. Whether you are using the Sharpe Ratio to calculate overall volatility or the Sortino ratio to measure downside volatility, these measurements can be added to your strategy as another means of evaluation.

Calculate the Sharpe and Sortino Ratios of your trading strategy using Python

import numpy as np
import pandas as pd

For simplicity, we will assume a risk-free rate of 0% and target return of 0%. I have imported some sample strategy returns to a dataframe labeled ‘Returns’.

rfr = 0
target = 0

returns = df['Returns']
sharpe_ratio = ((returns.mean() - rfr) / returns.std())

For the Sortino Ratio, we calculate the downside deviation of the expected returns by taking the difference between each period’s return and the target return. If a period’s return is greater than the target return, the difference is simply set to 0. Then, we square the value of the difference. Next, we calculate the average of all squared differences. The square root of the average is the downside deviation.

df['downside_returns'] = 0
df.loc[df['Returns'] < target, 'downside_returns'] = df['Returns']**2
expected_return = df['Returns'].mean()
down_stdev = np.sqrt(df['downside_returns'].mean())
sortino_ratio = (expected_return - rfr)/down_stdev

Get your free API token and start algo trading with Python!

To generate your API token:

  1. Register for a free practice account here.
  2. Log into and click on the account ID in the upper right corner.
  3. Click token management and generate your token.


  1. The Sharpe Ratio
  2. Sharpe Ratio and Its Applications in Algorithmic Trading
  3. Sortino ratio
  4. Sortino ratio: A better measure of risk

Risk Warning: The FXCM Group does not guarantee accuracy and will not accept liability for any loss or damage which arise directly or indirectly from use of or reliance on information contained within the webinars. The FXCM Group may provide general commentary which is not intended as investment advice and must not be construed as such. FX/CFD trading carries a risk of losses in excess of your deposited funds and may not be suitable for all investors. Please ensure that you fully understand the risks involved.