Python Tutorial 28 – Create the Comparable Company Analysis Bot, FMP Bot Using FMP API

Data intelligence is not a term to show off how you are good at using data to make right decisions. I believe nobody can say we have a right stock investment decision with 100% correct prediction. Data intelligence is like an advisor giving you a way to see the big picture and inspire you with new ideas, and be along with you in the critical thinking and analysis journey. The question is how to scably and automatically collect and update the data for CCA. This is what the article is about today – FMP Bot using FMP API

Comparable company analysis is one of the most popular approaches to evaluate the potential stock investment opportunities. It’s a well-known approach to evaluate private equity investment as well. Data is critical for CCA. I’m not saying the fragmented and dot by dot pattern of data. But I am saying the big data, the data can continuously flow in.

In this article, I will walk you through what FMP and FMP API are, and how you leverage them to build a bot scraping financial data. By the end of this Python Tutorial, you can learn what ingredients you need to create the Python script of the FMP bot, and how to find the symbol used in the script.

Comparable Company Analysis Bot – What Is Financial Modeling Prep or FMP API?

Financial Modeling Prep is a platform that offers you the best and real-time information about stock markets. That includes news, currencies, stock prices, and the symbol financials. It’s a great data source platform to get the valuable data you need. For example, you can get discounted cash flow statements of companies to see if they are undervalued, overvalued, or simply at par value. Or you can get the market data and financial side data for your CCA. It’s feasible for you to find all financial models and valuation techniques, data that are used in corporate finance to get companies’ intrinsic valuation.

python tutorial

For the financial modeling prep or FMP API, it offers you a fast lane to grab the data using python and push to your data management interface. If you are working on the list of company NPV to see the IRR, it takes you only a few seconds to grab all the comparable data. The company data comes from income statements over the past 5 years in a similar industry and product categories. So you can use the industrial revenue CAGR to forecast the revenue and gross profit.

What is the source of the FMP financials data – SEC

The U.S. Securities and Exchange Commission or SEC is an independent federal government regulatory agency responsible for protecting investors, maintaining fair and orderly functioning of the securities markets, and facilitating capital formation.

python tutorial

U.S Congress founded it in 1934 as the first federal regulator of the securities markets. The SEC promotes full public disclosure, protects investors against fraudulent and manipulative practices in the market, and monitors corporate takeover actions in the United States. It also approves registration statements for bookrunners among underwriting firms.

Therefore, you can grab all up-to-date and reliable listed company financial datasets by using FMP API. All data is from the SEC and endorsed by the government.

Python Tutorial – Stock Market Data & Financial Data you need to scrape for CCA

In the article regarding the stock valuation using comparable company analysis, I walk through 3 primary sections of data to analyze the potential investment opportunities. For more details, please check out this article.

Stock Valuation Using Comparable Company Analysis(CCA), Finviz, FMP

Essentially for generating the multiples such as EV/Sales, EV/EBITDA, EV/EBIT, you would need the market data and financial data. Regarding the marketing data, it needs three data metrics, which are price per share, market cap, and TEV.

FMP API provides the company enterprise value API, and this is the API endpoint you can use in your CCA and FMP bot script.

What’s more, you also need the financial data, such as sales or revenue, EBITDA, EBIT, earnings. FMP API provides the company financial income statement data. So you can utilize this API endpoint to grab the data'

python tutorial

For the API key token, you need to sign up an FMP account first and copy the API key that existed in your account setting. FMP account sign-up is totally free. It just takes you a few mins to create an account. It’s very easy and convenient.

Comparable Company Analysis Bot – Must-have Python Libraries and Ingredients

Basically, you can generate the data using requests calling the FMP API. Meanwhile, as the FMP is the JSON data format. You need the JSON library as well in the script.

import requests
import json
import csv
import pandas as pd
import gspread
import time
from oauth2client.service_account import ServiceAccountCredentials

For the data formatting, I would recommend you to use Pandas. And If you like to update the data to Google Sheets automatically, you can select gspread. For the details, I’m not going to explain. Please check out previous articles in the Python Tutorial collection.

The main ingredient the script needs is the comparable company list, which requires adding the symbols. The symbol represents the specific listed company. For example, the Apple symbol is AAPL.

I would recommend two ways for you to grab the list of symbols. One is you can utilize the Finviz platform. This is the platform I walked you through on how to find the comparable company symbols in this article. You can immediately get a list of potential companies by filtering the criteria. For the Finviz bot, I would specifically walk you through how to create using python in the other article.

Stock Valuation Using Comparable Company Analysis(CCA), Finviz, FMP

The other way is you can just google it or search for them in yahoo finance. Normally it would come up in SERP with the most relevant and popular symbols in the industry and similar product categories. For example, here is the best smart home listed companies in the public market.

Revenue CAGR using FMP API for the private eCommerce business valuation

FMP API is very powerful which is not only suitable for stock valuation and CCA. It can also be applied to private equity investment.

FMP company financial income statement provides the fiscal year revenue number over the past 5 years. The data is from the SEC, which is reliable to use as an anchor.

For the CAGR calculation, you can use the Google Sheet functions – power, to calculate. Take the smart home for example. FMP API can give you the past 5 years of sales of the listed company. So you can take the 1st year and the 5th year sale number to calculate the CAGR.

For getting a more convincing revenue CAGR, you can select all similar listed companies and use the media CAGR. That in a way represents this industry in the past 5 years.

For the potential private company in the comparable industry, you of course can easily have the product average order value and monthly traffic online. So you can calculate the 1st year GMV. Plus the industrial revenue CAGR, you can also forecast the 2nd, 3rd, 4th, and 5th year’s GMV.

Full Python Script of CCA and FMP Bot

If you would like to have the full version of the Python Script of Comparable Company Analysis Bot, please subscribe to our newsletter by adding the message Python Tutorial 28. We would send you the script immediately to your mailbox.

Contact us

I hope you enjoy reading Python Tutorial 28 – Create the Comparable Company Analysis Bot, FMP Bot Using FMP API. If you did, please support us by doing one of the things listed below, because it always helps out our channel.

  • Support my channel through PayPal (
  • Subscribe to my channel and turn on the notification bell Easy2Digital Youtube channel.
  • Follow and like my page Easy2Digital Facebook page
  • Share the article to your social network with the hashtag #easy2digital
  • Buy products with Easy2Digital 10% OFF Discount code (Easy2DigitalNewBuyers2021)
  • You sign up for our weekly newsletter to receive Easy2Digital latest articles, videos, and discount code on Buyfromlo products and digital software
  • Subscribe to our monthly membership through Patreon to enjoy exclusive benefits (

Leave a Reply

Your email address will not be published.