# Sharpe Ratio: Calculation, Application, Limitations

We all know that you should never put all your eggs in one basket. Hence, we try to build a portfolio consisting of different financial instruments. At the same time, you might develop different strategies to balance various measures such as risk, volatility, expected returns etc. But how do you say one strategy is better than the one? The normal answer, i.e., its return, is somewhat narrow in scope and does not help capture the big picture. Some strategies might be directional, some market neutral and some might be leveraged which makes annualized return alone a futile measure of performance measurement. Also, even if two strategies have comparable annual returns, the risk is still an important aspect that needs to be measured. A strategy with high annual returns is not necessarily very attractive if it has a high-risk component; we generally prefer better risk-adjusted returns over just ‘better returns’.

With this in mind, William Sharpe introduced a simple formula to help compare different portfolios and help us find the most feasible of them all. Let’s understand its mechanism in this article.

In this blog, we will cover the following topics:

## What is Sharpe Ratio?

Sharpe ratio is a measure for calculating risk-adjusted return. It is the ratio of the excess expected return of investment (over risk-free rate) per unit of volatility or standard deviation.

Let us see the formula for Sharpe ratio which will make things much clearer. The sharpe ratio calculation is done in the following manner

Sharpe Ratio = (Rx – Rf) / StdDev(x)

Where,
x is the investment
Rx is the average rate of return of x
Rf is the risk-free rate of return
StdDev(x) is the standard deviation of Rx

Once you see the formula, you will understand that we deduct the risk-free rate of return as this helps us in figuring out if the strategy makes sense or not. If the Numerator turned out negative, wouldn’t it be better to invest in a government bond which guarantees you a risk-free rate of return? Some of you would recognise this as the risk-adjusted return.

In the denominator, we have the standard deviation of the average return of the investment. It helps us in identifying the volatility as well as the risk associated with the investment.

Thus, the Sharpe ratio helps us in identifying which strategy gives better returns in comparison to the volatility. There, that is all when it comes to sharpe ratio calculation.

Let’s take an example now to see how the Sharpe ratio calculation helps us.

You have devised a strategy and created a portfolio of different stocks. After backtesting, you observe that this portfolio, let’s call it Portfolio A, will give a return of 11%. However, you are concerned with the volatility at 8%.

Now, you change certain parameters and pick different financial instruments to create another portfolio, Portfolio B. This portfolio gives an expected return of 8%, but the volatility now drops to 4%.

Considering the fact that the risk-free rate of return is 3%, the Sharpe Ratio calculation for both portfolios.  is as follows

 Portfolio A Portfolio B Rate of return 11 8 Risk-free rate of return 3 3 Volatility 8 4 Sharpe Ratio (11-3)/8 = 1 (8-3)/4 = 1.25

Thus, according to the Sharpe Ratio calculation, we should consider Portfolio B because even though the expected return is less than portfolio B, the volatility of portfolio B is less than portfolio A and thus, is less risky.

Currently, most exchange-traded funds provide the Sharpe ratio for their investments on their websites as well.

Sharpe Ratio can be used in many different contexts such as performance measurement, risk management and to test market efficiency. When it comes to strategy performance measurement, as an industry standard, the Sharpe ratio is usually quoted as “annualised Sharpe” which is calculated based on the trading period for which the returns are measured. If there are N trading periods in a year, the annualised Sharpe is calculated as:

Sharpe Ratio = √N (E(Rx – Rf) / StdDev(x))

For an intraday trading strategy, instead of using the conventional Sharpe calculation we can calculate the trade level Sharpe to get a better view of the strategy’s performance. In this case, the risk-free rate can be considered to be 0 since we don’t roll over positions, there is no interest charge. Sharpe ratio can be calculated by following these simple steps:

Say the strategy does “N” number of trades in a day; calculate:

1. The P&L for each trade (which is essentially what you make in excess of the brokerage you pay)
2. The mean of P&Ls for all trades
3. The standard deviation for P&Ls for all trades

Now, as per the definition, the numerator, which is the mean of PnL gets multiplied by N when you consider all trades. Furthermore, in the denominator, the standard deviation gets multiplied by the square root of ‘N’. So effectively, the Sharpe ratio is sqrt(N) *(mean/std dev).

For high-frequency strategies, a large number of small successful trades for specific amounts smoothen the PnL curve and the standard deviation approaches to zero which significantly spikes the Sharpe ratio, such that it might range in double digits.

On its own, any strategy with “annualized Sharpe ratio” less than 1 (after including execution costs) is usually ignored. Most Quantitative hedge funds ignore strategies with annualized Sharpe ratio less than 2. For a retail algorithmic trader, an annualized Sharpe ratio greater than 2 is pretty good. For high-frequency trading, as discussed, the ratio can go up in double digits as well, especially for opportunity-driven but not highly scalable strategies.

The ratio is used by an individual when they are adding a new financial instrument to an existing portfolio, and they want to check how it impacts the portfolio.

## Sharpe ratio in Python

If you would like to find the Sharpe ratio on your own, you can try the following Python code:

# Load the required modules and packages
import numpy as np
import pandas as pd
# Pull NIFTY data from Yahoo finance
# Compute the logarithmic returns using the closing price
returns = np.log(NIFTY['Close'] / NIFTY['Close'].shift(1))
volatility = returns.std() * np.sqrt(252)
sharpe_ratio = (returns.mean() - 0.05) / volatility
sharpe_ratio


The above program gives the following output:

In the above code, we have assumed the risk-free rate of return as 5%, which can be changed accordingly.

## Limitations of Sharpe ratio

There are several limitations with the usage of Sharpe Ratio, due to certain assumptions and the way it has been defined. Some of the important limitations have been listed below:

• The calculation of Sharpe ratio pivots on the assumption that returns are normally distributed, but in real market scenarios, the distribution might suffer from kurtosis and fatter tails, which decreases the relevance of its use.
• Sharpe ratio cannot differentiate between intermittent and consecutive losses as the risk measure is independent of the order of various data points. Thus, while it is good for long term analysis, it might be counterproductive if we decide on a portfolio which has a significant share of stocks which are losing value in the past few trading periods.
• Another notable drawback of Sharpe ratio is that it cannot distinguish between upside and downside and focuses on volatility but not its direction. The ratio would penalize a system which exhibited sporadic sharp increases in equity, even if equity retracements were small.
• As with most parameters, Sharpe ratios is backwards-looking and accounts for historical returns and volatility. The decisions based on the ratio assume future performance will be similar to the past.
• It can be manipulated by individuals to present their best side. If the three-year Sharpe ratio of a portfolio does not present an interesting proposition, the fund manager could, in theory, calculate a 5 year time period knowing that the portfolio had performed well before.

To counter the Sharpe ratio’s weakness in accounting for all risk, the Sortino ratio was developed. Let’s look at it in the next section.

## Sharpe ratio vs Sortino ratio

In simple terms, if you were looking at a portfolio of stocks and going long at all of them, you would not account for the deviation of the returns above the expected return of the portfolio when you are trying to find the risk. If your expected return is 10%, the returns of 15% is not a risk which we shouldn’t account for when we calculate the standard deviation. The fact that we factor in only the times the price goes downwards, means we are only taking into account the downside risk.

While calculating the standard deviation for the Sortino ratio, we take into account the downside risk only and thus, get a clearer picture than the Sharpe ratio.

For example, if we take into account the above example and after calculating the downside deviation only, we see that the downside deviation in Portfolio A is only 2% while of portfolio B is the same ie 4, we will get the following updated table:

 Portfolio A Portfolio B Rate of return 11 8 Risk-free rate of return 3 3 Volatility 8 4 Sharpe Ratio (11-3)/8 = 1 (8-3)/4 = 1.25 Downside risk 2 4 Sortino Ratio (11-3)/2 = 4 (8-3)/4 = 1.25

Thus, we now realise that Portfolio A is a better investment than Portfolio B.

As you have seen above, the Sortino ratio can be written as:

Sortino Ratio: (Rx – Rf) / StdDev(d)

Where,
x is the investment
Rx is the average rate of return of x
Rf is the risk-free rate of return
StdDev(d) is the standard deviation of the downside.

Thus, in this manner, the Sortino ratio overcomes some of the limitations of the Sharpe ratio and is comparatively better for the investors or fund managers.

## Conclusion

Thus, we have seen how Sharpe ratio is used to get a better understanding about the relation between the expected returns and the volatility of a portfolio and also as a tool of comparison tool between different strategies or portfolios. We also went through its limitations and how Sortino ratio helps overcome some of them.

If you want to learn various aspects of Algorithmic trading and automated trading systems, then check out the Executive Programme in Algorithmic Trading (EPAT®). The course covers training modules like Statistics & Econometrics, Financial Computing & Technology, and Algorithmic & Quantitative Trading. EPAT® equips you with the required skill sets to build a promising career in algorithmic trading. Enroll now!

Disclaimer: All data and information provided in this article are for informational purposes only. QuantInsti® makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information in this article and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.