Is there more steam left in the market? #
Analysing whether NIFTY is overvalued/undervalued using P/E ratio #
P/E ratio or price to earnings ratio is an indicator many investors use to guage whether the stock or index is overvalued or undervalued (you can read more on P/E here). NSE provides historical P/E ratios for various indices so in this article we will see how the NIFTY P/E ratios have varied historically and what it could mean in current scenario.
from datetime import date
from nsepy import get_index_pe_history, get_history
lets download P/E ratios and NIFTY historical values right from 2005 till today (18 Dec)
nifty_pe = get_index_pe_history(symbol="NIFTY",
start=date(2005,1,1),
end=date(2020,12,18))
nifty = get_history(symbol="NIFTY",
start=date(2005,1,1),
end=date(2020,12,18),
index=True)
Save the dataframe for later use so that we don’t have to fetch the data again
nifty_pe.to_pickle("nifty_pe.pkl")
nifty.to_pickle("nity.pkl")
Lets combine the two dataframes and see how nifty and P/E move together
nifty['P/E'] = nifty_pe['P/E']
We will now see what kind of yearly returns you would have got, had you invested in NIFTY at a particular P/E level. For this we will calculate forward looking returns by shifting Closing price by 252 (there are approximately 253 trading days in a year in US, it might be slightly different for India but for our analysis few days here and there would not matter much)
nifty['Shifted'] = nifty['Close'].shift(periods=-252)
nifty['ForwardReturns'] = (nifty['Shifted']-nifty['Close'])*100/nifty['Close']
nifty[['Close', 'Shifted', 'ForwardReturns','P/E']].head()
Close | Shifted | ForwardReturns | P/E | |
---|---|---|---|---|
Date | ||||
2005-01-03 | 2115.00 | 2883.35 | 36.328605 | 15.57 |
2005-01-04 | 2103.75 | 2904.40 | 38.058229 | 15.49 |
2005-01-05 | 2032.20 | 2899.85 | 42.695109 | 14.96 |
2005-01-06 | 1998.35 | 2914.00 | 45.820302 | 14.71 |
2005-01-07 | 2015.50 | 2910.10 | 44.386008 | 14.84 |
As you can see from above table, if you had invested in NIFTY on 3rd of Jan 2005 at P/E of 15.57, you would have got returns of 36.32% a year later. Now lets look at a scatter plot to see what kind of annual returns we would expect by investing at different P/E levels.
nifty[['ForwardReturns', 'P/E']].plot.scatter(x='P/E',y='ForwardReturns', figsize=(20,10), grid=True)
<AxesSubplot:xlabel='P/E', ylabel='ForwardReturns'>
Few conclusions we can draw from historical data -
- Lower the P/E at the time of investment, higher the annual return investor has received
- There are very few instances of negative annual returns for P/E < 20
- You are highly likely to get a negative annual return if you had invested at P/E > 27.5
As of today (18th December 2020) the NIFTY P/E stands at more than 35 and NIFTY looks highly overvalued in my opinion. Let me know what do you think in the comments below.
nifty['P/E'].plot(figsize=(20,10), grid=True)
<AxesSubplot:xlabel='Date'>
Disclaimer #
The above analysis is for educational purpose only, readers are advised to use their own judgement or consult your investment advisors for any investment decisions.