FMP
Sep 11, 2023 5:38 PM - Rajnish Katharotiya
Price to Earnings is one of the key metrics use to value companies using multiples. The P/E ratio and other multiples are relative valuation metrics and they cannot be looked at in isolation.
One of the problems with the P/E metric is the fact that if we are in the peak of a business cycle, earnings are going be very high. And by definition, high earnings will lead to a low P/E ratio skewing our analysis.
In this post, we are going to learn how to normalize earnings so that the business cycle do not impact our P/E ratio analysis. At the end of it, we will be able to calculate P/E ratios using normalized earnings. Similarly to my prior posts, we will use Python to automate the process.
Photo by Pixabay on Pexels
Business cycles tend to repeat themselves over the long time. There is always a peak and a bottom of the cycle. Peaks and bottoms are not the best timing to compute P/E ratios. Ideally, we should account for this cyclicality when looking into the price earnings ratio. To do so, we use normalized earnings.
By adjusting earnings per share (EPS) for cyclicality, we avoid to have a distorted P/E ratio due to cyclicality. We have two different alternatives available to normalize EPS:
Average EPS over previous periods. With this method, we compute an average EPS using historical earnings (use the same number of periods as the duration of the business cycle). Then, we use the normalized EPS to compute the P/E ratio. The problem with this approach is that it does not account for the size/growth of the company. If a company is in a growing phase, EPS will grow no matter if the business cycle is peaking or in recession skewing our results. Therefore, normalizing eps using this method is only recommended for mature companies. For growing companies, we can use the ROE method described below.
Average Return on Equity (ROE). Through this approach, we normalize EPS using the historical ROE average. Then, we use the latest Book value per share in order to account for size growth.Business cycles can have different impacts in different companies. To normalize earnings per share, it is recommended to assess how long a business cycle may last. There is not a standard duration of business cycles as shown in the following Wikipedia table.
Now that we know how to normalize EPS, we can start using Python to calculate PE ratios through normalized earnings. Lets have first a quick look at the formulas:
Normalize P/E using average EPS= P/E where E is the Average EPS of last n years
Normalize P/E using average ROE = P/E where E is the Average ROE of last n years * the latest BVPS
To calculate P/E ratio using normalized earnings, we will need below metrics:
Diluted EPS
Price to Book
Value Ratio
Return on Equity
In the code below, we using three different API end points to retrieve the required financial metrics. All API end points can be found in the official documentation.
The idea of below code is to store all our metrics into a Python dictionary, and then convert them into a Pandas DataFrame. A Pandas DataFrame will facilitate the calculation of the company normalized EPS. Note that we need to pass an API key within the api_key variable. The code can be reused for any other company.
We use the diluted EPS in order to account for any potential dilutions and retrieve the data for the last 8 years. In reality, the current business cycle is lasting than 8 years but we will keep it simple in this post.
import pandas as pd
import requests
api_key = 'your api key'
company = 'MSFT'
eps = requests.get(f'https://financialmodelingprep.com/api/v3/income-statement/{company}?limit=12&apikey={api_key}').json()
eps = eps[:8]
analysis_data = {}
for item in eps:
analysis_data[item['date']] = {}
analysis_data[item['date']]['eps'] = item['epsdiluted']
analysis_data
key_metrics = requests.get(f'https://financialmodelingprep.com/api/v3/key-metrics/{company}?limit=10&apikey={api_key}').json()
key_metrics = key_metrics[:8]
for item in key_metrics:
analysis_data[item['date']]['BVPS'] = item['bookValuePerShare']
analysis_data[item['date']]['ROE'] = item['roe']
analysis_data[item['date']]['PE'] = item['peRatio']
normalized_EPS = pd.DataFrame(analysis_data)
normalized_EPS
After running the code above, we have the required metrics by year in the normalized EPS DataFrame.
Finally, we calculate the P/E ratios using the normalised earnings. In the code below, we use the two methods described in the prior section to do so:
normalize_mean = normalized_EPS.mean(axis=1)
eps_average = normalize_mean['eps']
roe_average = normalize_mean['ROE']
latest_BVPS = normalized_EPS.iloc[1:2,0][0]
price= requests.get(f'https://financialmodelingprep.com/api/v3/profile/{company}?apikey={api_key}').json()
price = price[0]['price']
PEnormalized_average_eps = price/eps_average
print(PEnormalized_average_eps)
normalized_eps_average_ROE = roe_average*latest_BVPS
PEnormalized_ROE_EPS = price/normalized_eps_average_ROE
print(PEnormalized_ROE_EPS)
The outcome of the code is the P/E ratio computed using normalised earnings.
Jan 16, 2024 4:18 PM - Samuel Abdelshahid
In the hustle and bustle of the trading world, having a trustworthy laptop is like having a reliable partner by your side. Making well-informed decisions and staying ahead of market trends become second nature with the right device. However, the quest for a budget-friendly trading laptop t...
Jan 21, 2024 4:00 AM - Parth Sanghvi
Introduction: In the world of financial analysis, a profound grasp of essential profitability metrics is vital. This blog delves into three pivotal metrics—ROE (Return on Equity), ROA (Return on Assets), and Net Profit Margin—offering clear insights without unnecessary complexity. Exploring RO...
May 14, 2024 11:41 AM - Sanzhi Kobzhan
A stock's target price, also known as its fair value, is an indication of what a share can cost based on the company’s forecasted financial statements. It is important to know a stock's fair value to find undervalued stocks with great growth potential. Let's consider how investment analysts calculat...