Trading Analytics with Financial KPIs. Part I. Collecting the KPIs

Oleg Kazanskyi
5 min readJun 8, 2022

--

Photo by Markus Spiske on Unsplash

FOREWORD

In the series of articles, I would test a non-time-series analysis of the stocks trading data from the S&P 500. The approach is based on thinking of data from financial markets as a performance evaluation rather than seasonal movements.

We will be looking for specific points when fair evaluation (calculated by our model) differs from market value so we can buy cheap or sell high. This method wouldn't work on short-term deals, but it may work for a timeframe of several days to several months.

The whole process is a little lengthy, so I split it into several parts. We are going to identify the list of required Financial KPIs and create scripts to collect them in this part. We will use those for our future ML model.

Using financial KPIs is beneficial for several reasons. Firstly, the KPIs show the proportion or ratio, usually with a limited range. It reduces the time required later for data optimization. Secondly, they combine several parameters, making the number of variables lower, leading to a lighter and more manageable model.

Photo by Deon Black on Unsplash

FINANCIAL KPIs

First, let's list the KPIs that might help us understand how good the company performs and is the value justified:

  1. Return on Equity. It shows how effectively a company uses investors' money.

2. Long-Term Debt to Equity. Evaluates the company's financial leverage

3. Debt-to-Equity Ratio. The more a company's operations are funded by borrowed money, the greater the risk of bankruptcy.

4. Current Ratio. Company's short term liquidity

5. Gross Margin. The percentage of revenue a company retains after subtracting the costs directly related to the sale of goods or services.

6. Revenue Quarter over Quarter. How well the company is performing compared to the previous quarter.

7. The Piotroski score. The Piotroski score is used to determine the best value stocks, with nine being the best and zero being the worst.

8. Return on Assets. It indicates how profitable a company is in relation to its total assets

9. Earnings per Stock. The portion of a company's profit allocated to each outstanding share of common stock

10. Price to Earnings Ratio. How many years of a company's returns are required to buy back its value with the current earnings.

11. Price/Earnings to Growth Ratio. It helps to understand if the number of years in PE calculation can be adjusted by the company's growth compared to last year.

12. Dividend Payout Ratio. The portion of earnings a company pays as dividends.

13. Dividends Yield. The percentage of a company's share price that it pays out in dividends each year.

14. Accounts Receivable Turnover Ratio. The ratio enables companies to determine if their credit policies and processes support good cash flow.

15. Industry. Different sectors of the economy are evaluated differently and may have a considerable variation in the acceptable levels of KPIs.

GETTING THE DATA

With the identified list of parameters, we need a source of the data where we can download all of these. And it should be free and easy to use, of course. :-)

The best option I found is https://www.tiingo.com/ which provides a wide range of data with a free account and an option of future extension.

The next follows Python code that can pull most of the required parameters for our analysis data. You will need an API access token to use it.

These functions will get for us:

  • daily trading data by stock;
  • fundamentals like a Market Cap, Enterprise Value, P/E and P/B ratio, P/E to Growth Ratio;
  • Industry and Country from the stock's metadata;
  • all the financial statements data that we will use for our analysis, like Total Assets, Accounts Payable, Short & Long term Debts

COMBINING THE DATA

Using the functions above, we get most of the required variables. However, still, we need to combine all of these into one table and calculate several parameters on our own: Debt to Equity Ratio, Dividends Yield, Payout Ratio, Accounts Receivable Turnover Ratio, and Earnings per Stock.

Here is a python script for this:

WHAT'S NEXT?

After gathering all the financial KPIs, it is still too early to start the analysis process. Other parameters we did not cover have significant impact on stock valuation, like:

  • external market conditions like high volatility in times of wide market shake and uncertainty,
  • the borrowing costs,
  • market players' future expectations about the company's earnings and yield.

Covering those in the same article would make it too big and hard to read. I will stop on these in my next writing.

Please follow up!

--

--

Oleg Kazanskyi

Master of Finance with a high passion for BI and Data Analysis