FMP

# Evaluate Companies Liquidity with Python

## Evaluate Companies Liquidity with Python

Sep 11, 2023 5: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

## Company liquidity - An Introduction

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

## Calculating Companies Liquidity with Python

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

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)

## Wrapping Up

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.

### Other Blogs

Sep 11, 2023 - Rajnish Katharotiya

## P/E Ratios Using Normalized Earnings

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

Sep 11, 2023 - Rajnish Katharotiya

## What is Price To Earnings Ratio and How to Calculate it using Python

Price-to-Earnings ratio is a relative valuation tool. It is used by investors to find great companies at low prices. In this post, we will build a Python script to calculate Price Earnings Ratio for comparable companies. Photo by Skitterphoto on Pexels Price Earnings Ratio and Comparable Compa...

Oct 17, 2023 - Davit Kirakosyan

## VMware Stock Drops 12% as China May Hold Up the Broadcom Acquisition

Shares of VMware (NYSE:VMW) witnessed a sharp drop of 12% intra-day today due to rising concerns about China's review of the company's significant sale deal to Broadcom. Consequently, Broadcom's shares also saw a dip of around 4%. Even though there aren’t any apparent problems with the proposed solu...

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.