By Apoorva Singh and Rekhit Pachanekar
Sharpe Ratio helps compare different portfolios and find the most feasible of them all. This blog explains its mechanism and everything that you need to know about it.
We cover:
 What is Sharpe Ratio?
 Formula of Sharpe Ratio
 Calculation of Sharpe Ratio
 Example of Sharpe Ratio
 Sharpe Ratio in Python
 Limitation of Sharpe Ratio
 Sharpe Ratio vs Sortino Ratio
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 highrisk component; we generally prefer better riskadjusted 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  the Sharpe Ratio.
What is Sharpe Ratio?
Sharpe ratio is a measure for calculating riskadjusted return. It is the ratio of the
excess expected return of the investment (over riskfree rate) per unit of volatility
or standard deviation of investment’s returns.
Let us see the formula for the Sharpe ratio, which will make things much clearer.
Formula of Sharpe Ratio
The Sharpe ratio formula is:
Sharpe Ratio = \((R_x – R_f ) / StdDev_x\)where,
 R_{x} is the average rate of return of x
 R_{f} is the riskfree rate
 StdDev_{x} is the standard deviation of an investment’s return
Calculation of Sharpe Ratio
Once you see the formula, you will understand that we deduct the riskfree rate of return, which helps us figure out if the strategy makes sense.
If the Numerator turned out negative, wouldn’t it be better to invest in a government bond that guarantees you a riskfree rate of return? Some of you would recognise this as the riskadjusted return.
In the denominator, we have the standard deviation of the investment’s return. It
helps us identify the volatility and the risk associated with the investment. Thus, the Sharpe ratio helps us identify which strategy gives better returns compared to the volatility. There, that is all when it comes to Sharpe ratio calculation.
Example of Sharpe Ratio
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 riskfree rate of return is 3%, the Sharpe Ratio calculation for both portfolios. is as follows
Portfolio A 
Portfolio B 

Rate of return 
11 
8 
Riskfree rate of return 
3 
3 
Volatility 
8 
4 
Sharpe Ratio 
(113)/8 = 1 
(83)/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 exchangetraded 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”.
Annualised Sharpe 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(R_{x} – R_{f}) / StdDev_{(x)})
Trade Level Sharpe ratio for Intraday Strategies
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 riskfree 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:
 The P&L for each trade (which is essentially what you make in excess of the brokerage you pay)
 The mean of P&Ls for all trades
 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 highfrequency 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 highfrequency trading, as discussed, the ratio can go up in double digits as well, especially for opportunitydriven 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:
The above program gives the following output:
In the above code, we have assumed the riskfree 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 backwardslooking 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 threeyear 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 
Riskfree rate of return 
3 
3 
Volatility 
8 
4 
Sharpe Ratio 
(113)/8 = 1 
(83)/4 = 1.25 
Downside risk 
2 
4 
Sortino Ratio 
(113)/2 = 4 
(83)/4 = 1.25 
Thus, we now realize that Portfolio A is a better investment than Portfolio B.
As you have seen above, the Sortino ratio can be written as:
Sortino Ratio: (R_{x} – R_{f}) / StdDev_{(d)}
where,
 x is the investment
 R_{x} is the average rate of return of x
 R_{f} is the riskfree 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.
To learn various aspects of Algorithmic trading and automated trading systems, check out our algo trading course which 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 investments and trading in the stock market involve risk. Any decision to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this article is for informational purposes only.