FMP
Sep 11, 2023 6:28 PM - Rajnish Katharotiya
Image credit: Max Harlynking
Liquidity is an important factor to take into account when analysing a company. Liquidity is a measure to determine how capable a company is to meet its short term obligations. In this article, we are going to learn how to evaluate companies liquidity with Python. We will use below four liquidity ratios for our analysis:
Working Capital
Current Ratio
Quick Ratio
Cash Ratio
Photo by PhotoMIX Ltd. on Pexels.com
Liquidity is a very useful measure to analyse a firm's capacity to meet its short term obligations. Liquidity is used to as a metric to know how quickly an asset can be converted into cash.
Note the difference between liquidity and solvency measure. Liquidity ratios focus on short term liabilities. On the other hand, solvency measures focus on long term obligations. In this post, we will focus on liquidity ratios.
There are a few ratios very useful to determine the liquidity level of a company. These ratios are particularly useful to compare companies within the same sector and size. Lets have a quick look at each of them:
First Liquidity Measure: Working Capital. Working capital is the difference between current assets and current liabilities. It measures a company current resources to meet short term needs.
If a firm has positive working capital it has the capacity to invest and growth. However, if it has negative working capital, it may have troubles covering current liabilities and may face bankruptcy.
Working Capital = Current Assets - Current Liabilities
Second Liquidity Measure: Current Ratio. Similarly to working capital, the current ratio is a liquidity measure that analyses how good a company can meet short term obligations.
Differently than working capital, current ratio enable comparison across similar companies.
A current ratio that is a bit higher than the industry average is considered as good. A very high current ratio compare to the industry average may indicate that the company management does not use the assets efficiently.
Current Ratio = Current Assets / Current Liabilities
Third Liquidity Measure: Quick Ratio. One of the potential drawbacks from the current ratio is that it includes Inventory. Inventory may not be very liquid and therefore in case of companies in needs of cash in the very short term, they may not be able to convert Inventory into cash as easy as desired.
In this case, to analyse a company's liquidity without taking Inventory into consideration, we can use the quick ratio which excludes inventory from the current assets.
Quick ratio indicates how good a company can meet short term obligations without the need to sell inventories
Quick Ratio = (Cash + Marketable Securities + Receivables) / Current Liabilities
Fourth Liquidity Measure: Cash Ratio. And the last of our liquidity metrics is the cash ratio. Cash ratio excludes inventory and receivables from a company in order to only have current assets that are very easily convertible into cash.
Cash Ratio = Cash + Marketable Securities/ Current Liabilities
Now we know a bit more about a company liquidity and how to measure. Let's calculate these four ratios with Python.
As already mentioned before, it is important to compare ratios among similar companies. For that reason, we are going to calculate liquidity ratios for companies operating in the Technological sector and with a market capitalisation bigger than $100 billions.
First thing we need to do is to identify the companies that we want to analyse. Using below API endpoint, we are able to filter out companies in the technological sector and with a market capitalisation bigger than $100 billions.
We will add them to a list called technological_companies.
import requests
demo = {your API key}
companies = requests.get(f'https://financialmodelingprep.com/api/v3/stock-screener?marketCapMoreThan=1000000000§or=Technology&limit=100&apikey={demo}')
companies = companies.json()
technological_companies = []
for item in companies:
technological_companies.append(item['symbol'])
print(technological_companies)
Next, we need to retrieve Balance Sheet elements such as current assets, current liabilities, cash, etc. For this, we can use the following API endpoint. The API response will return the balance sheet for each of the companies passed as a parameter in the url.
We will loop trough our technological companies list and get balance sheet data for each company. Then, we will parse the required information to calculate the ratios. Finally, we add each of the ratios to a Python dictionary called liquidity_measures:
liquidity_measures = {}
for item in technological_companies:
try:
BS = requests.get(f'https://financialmodelingprep.com/api/v3/balance-sheet-statement/{item}?period=quater&apikey={demo}')
BS = BS.json()
#Working Capital Calculation and Current Ratio
current_Assets = BS[0]['totalCurrentAssets']
current_Liabilities = BS[0]['totalCurrentLiabilities']
working_Capital = current_Assets - current_Liabilities
current_Ratio = (current_Assets/current_Liabilities)
#Quick ratio calculation
cash = BS[0]['cashAndCashEquivalents']
marketable_Securities = BS[0]['cashAndShortTermInvestments']
receivables = BS[0]['netReceivables']
quick_Ratio = (cash + marketable_Securities + receivables )/current_Liabilities
#Cash ratio calculation
cash_Ratio = (cash + marketable_Securities) / current_Liabilities
#store liquidity ratios for each company to liquidity_measures dictionary
liquidity_measures[item] = {}
liquidity_measures[item]['working_capital'] = working_Capital
liquidity_measures[item]['current_ratio'] = current_Ratio
liquidity_measures[item]['quick_ratio'] = quick_Ratio
liquidity_measures[item]['cash_ratio'] = quick_Ratio
except:
pass
print(liquidity_measures)
With a few lines of code, we were able to calculate four different liquidity ratios. Now we can evaluate technological companies liquidity with Python by comparing these ratios across the different companies.
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...
May 24, 2024 9:30 AM - Rajnish Katharotiya
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...
May 27, 2024 3:30 PM - Rajnish Katharotiya
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...