FMP

FMP

Enter

Analyse a Company Return on Equity ROE with Python

-

twitterlinkedinfacebook
blog post cover photo

Image credit: ThisisEngineering RAEng

In this post, we will analyze what are the drivers behind companies ROE growth. We are going to breakdown ROE into three elements to analyze a company Return on Equity with Python.

What is Return on Equity (ROE)?

Return on equity shows how much profit a company makes using the money invested by shareholders. In this article, we will focus on how we can analyze and breakdwon increases and decreases in a company return on equity.

Multiple financial analysts look into ROE to check companies performance. However, ROE by itself is a very bad indicator. ROE is a function of a lot of things, and making a financial decision based on ROE alone is not enough, we need to analyze additional information. For instance, if ROE has increased from year to year, we need to understand why this is the case.

Below is the return on equity graph from Apple. It has increase quite a lot during the last three years. What is driving this ROE increase?

Apple return on equity - from macrotrends.net. Source: https://www.macrotrends.net/stocks/charts/AAPL/apple/roe

There are three possible scenarios that we will analyse leading to the increase of Apple return on equity:

  • Is Apple taking on recently more debt, and therefore, since the level of risk increases, the ROE also increases? If the asset to equity ratio has increased, this would mean that assets are higher relative to equity than a few years back. Therefore, that increase of assets have to be financed by debt which increases risk of shareholders. (Remember that Assets has to equal equity + liabilities).

  • Or has the firm become more efficient during the last year so that assets are more efficient? I.e. is the firm technically more efficient?

  • Or has the ROE increased simply because the firm is more profitable now than in prior periods?

We can breakdown return on equity to analyze each of this three components. We will use the DuPont method to decompose return on equity into three parts: firm financial structure, technical efficiency and profitability - to understand the drivers behind ROE variations.

What are the drivers behind Return on Equity? The DuPont method can be used to analyze the parts of a firm's return on equity. It is especially useful in order to find out what are the main drivers behind company return on equity changes.

Below is the DuPont formula that we will use in the second part of the article to analyze return on equity (ROE) changes with Python:

Source: https://accountingplay.com/glossary/du-pont-formula/

Analyzing Firm's ROE with Python

Note that above formula can also be used to calculate the ROE of a company. However, if you are only interested in knowing the return of equity, you could simply calculate it by using net income and equity. We will only use DuPont formula to see the drivers of ROE variations.

From the DuPont formula, we see that return on equity can be breakdown into three ratios:

  • Profitability: Net Income to Sales is the net profit margin. And it gives us an idea on how profitable a company is.

  • Asset Turnover: Sales to total assets is known as the asset turnover ratio. It indicates how efficient a company is using its assets (i.e. technical efficiency).

  • Capital structure or leverage ratio: Total assets to shareholders equity is used to measure the financial leverage of a company.

What is the healthiest way to increase return on equity?Let's have a look into each of the three ratios composing return on equity to understand which of the three ratios would be seen as a good way to increase ROE.

First is profitability. If a firm increases profitability, ROE will therefore increase as well. Net income to sales will be higher meaning that it is very likely that the company has been able to reduce operating expenses pushing the net profit margin up.

The second element is asset turnover. If the sales to total assets increases over the years, it means that the firm is using its assets more efficiently to generate sales. Therefore, an increase in the asset turnover will lead companies to generate more sales with the same number of assets and therefore ROE will increase.

The third element that can lead to an variation of ROE is financial leverage. If a firm increases debt, the return on equity will increase as well. By having higher debt level, a firm is viewed as riskier, and therefore, shareholders would require a higher ROE.

To sum up, we should be rewarding firms which increase ROE through an increase of profitability or asset turnover.

On the other hand, increasing ROE through the use of debt should be taken with caution. Especially, if a firm taking on more debt is not increasing profitability and asset turnover.

Breaking down Return on Equity using DuPont Analysis

Now that we know how to analyze return on equity, let's analyze a company ROE with Python using financialmodellingprep API.

What we are going to do is to breakdown the last three years of Apple return on equity into profitability, asset turnover and financial leverage. This will let us see how the company has increase ROE over this three year period.

We will need to retrieve net income and revenue from the income statement. And assets and shareholders equity from the Balance Sheet. Therefore, we will make two API calls to the respective API end point to retrieve the whole balance sheet and income statement:

import requests

import pandas as pd

demo = 'your api key'

stock = 'AAPL'

BS = requests.get(f'https://financialmodelingprep.com/api/v3/balance-sheet-statement/{stock}?apikey={demo}').json()

BS2019 = BS[3]

BS2020 = BS[2]

BS2021 = BS[1]

BS2022= BS[0]

IS = requests.get(f'https://financialmodelingprep.com/api/v3/income-statement/{stock}?apikey={demo}').json()

IS2020 = IS[2]

IS2021 = IS[1]

IS2022 = IS[0]

Note that we pass stock and demo variables as part of the url. You can perform the analysis with any other stock by placing the ticker in the stock variable.

The variables BS and IS contains a list of dictionaries. Each element of the list is a dictionary containing the financials for a financial year. Therefore, we index BS and IS using [0] in oder to extract the latest financial year (i.e. 2022). Then, we do the same with the previous three years.

Note that for the balance sheet, we also extract the year 2019 since we will be using it to calculate the average equity and assets for 2020.

Next, we calculate each of the three ratios composing ROE:

#Element 1 net income / sales as profitability indicator:

Profitability2020 = IS2020['netIncome']/IS2020['revenue']

Profitability2021 = IS2021['netIncome']/IS2021['revenue']

Profitability2022 = IS2022['netIncome']/IS2022['revenue']

#Element 2 Technical Analysis

TechnicalEfficiency2020 = IS2020['revenue']/((BS2020['totalAssets'] + BS2019['totalAssets'])/2)

TechnicalEfficiency2021 = IS2021['revenue']/((BS2021['totalAssets'] + BS2020['totalAssets'])/2)

TechnicalEfficiency2022 = IS2022['revenue']/((BS2022['totalAssets'] + BS2021['totalAssets'])/2)

#Element 3 Firm Financial Structure

FinancialStructure2020 = ((BS2020['totalAssets'] + BS2019['totalAssets'])/2)/ ((BS2020['totalStockholdersEquity'] + BS2019['totalStockholdersEquity'] )/2)

FinancialStructure2021 = ((BS2021['totalAssets'] + BS2020['totalAssets'])/2)/ ((BS2021['totalStockholdersEquity'] + BS2020['totalStockholdersEquity'] )/2)

FinancialStructure2022 = ((BS2022['totalAssets'] + BS2021['totalAssets'])/2)/((BS2022['totalStockholdersEquity'] + BS2021['totalStockholdersEquity'] )/2)

Since assets and shareholder equity are changing over the period, we compute the average of them.

Finally, we calculate ROE as well for each of the three years:

ROE2020 = Profitability2020 * TechnicalEfficiency2020 * FinancialStructure2020

ROE2021= Profitability2021 * TechnicalEfficiency2021 * FinancialStructure2021

ROE2022 = Profitability2022 * TechnicalEfficiency2022 * FinancialStructure2022

And we add each of the elements into a Pandas DataFrame for easy visualization:

FY2020 = [Profitability2020,TechnicalEfficiency2020,FinancialStructure2020,ROE2020]

FY2021 = [Profitability2021,TechnicalEfficiency2021,FinancialStructure2021,ROE2021]

FY2022 = [Profitability2022,TechnicalEfficiency2022,FinancialStructure2022,ROE2022]

ROE_decomposition = pd.DataFrame([FY2020,FY2021, FY2022],columns=['Profitability *','Tech Efficiency *','Financial Strucutre =','ROE'],index=['2020','2021','2022'])

print(ROE_decomposition)

DuPont ROE Variation

Analyzing return on equity changes. By looking into Apple three ratios, we see that over the last three years the ROE has increased from 64% in 2020 to 152% in 2022. The increase is mainly due to an increase of technical efficiency and also through the increase of financial debt.

Technical efficiency has increased from 0.73 to 1.08 from 2020 to 2022. An increase of almost 35%. This is a good way to increase ROE.

ROE has also gone up due to an increase of debt. Apple financial leverage has increased compared to 2020 from 3.56 to 5.25.

On the other side, profit margin has not changed much compared to 2020.

Putting in perspective the three ROE elements, we could think that the increase of debt has been translated into a better use of the company assets but it did not lead to an increase of profitability.

Thanks a lot for reading this post where we have analyzed a company ROE with Python!

Other Blogs

May 14, 2024 11:41 AM - Sanzhi Kobzhan

The easiest way to calculate stock’s target price and why the target price is important.

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...

blog post title

May 24, 2024 9:30 AM - Rajnish Katharotiya

How to Access and Analyze Earnings Call Transcripts

Earnings call transcripts are invaluable resources for investors, analysts, and financial enthusiasts. They provide insights into a company's performance, strategy, and future outlook, making them essential for making informed investment decisions. With Financial Modeling Prep, Earnings Call Transcr...

blog post title

May 27, 2024 3:30 PM - Rajnish Katharotiya

The best 5 GPU stocks other than NVDA

In the ever-evolving world of technology, certain sectors have consistently demonstrated exceptional growth and innovation. The graphics processing units (GPUs) industry is one such sector, offering investors a golden opportunity for potentially high returns. In this blog, we'll delve into why inves...

blog post title
FMP

FMP

Financial Modeling Prep API provides real time stock price, company financial statements, major index prices, stock historical data, forex real time rate and cryptocurrencies. Financial Modeling Prep stock price API is in real time, the company reports can be found in quarter or annual format, and goes back 30 years in history.
twitterlinkedinfacebookinstagram
2017-2024 © Financial Modeling Prep