Company Revenue Analysis by Subsectors
By: Aidityas Adhakim · April 23, 2024
Suppose you have some spare cash—often referred to as “cold money”—that you’re looking to invest, particularly in the tobacco subsector, with a focus on companies financial. Naturally, you would need to examine the historical financial data of each potential investment, right? Well, relax; there’s no need to go through this process manually. With the Sectors Financial API, you can effortlessly access and visualize the necessary data!
Install Required Libraries
- Install the requests library to make HTTP Requests
- Install pandas to do some data exploratory
- In this recipe we will use altair to do the data visualization, if you are unfamiliar with altair, try to watch this playlist Altair Tutorial
- This is not a library, but you will need your API Keys for this recipe
Data Exploration
In this recipe we will use a few API from Sectors, here are the following API:
- List of Companies by Subsector API to retrieve all the companies in a subsector
- Individual Company Report per Section API to retrieve the financial data for each company
Using this API we will get the data we need and do some nice visualization on it. You should take a look at List All Subsectors Recipe also if you need a simple example of data exploration on Sectors Financial API.
List all companies by subsectors
Let’s take a look at list of companies under the tobacco subsectors
You should see an output like this:
These are the list of all companies under one subsector which in this recipe, we use tobacco subsectors.
Individual Company Report Per Section
After retrieving the list of companies under the tobacco subsector, the next step is to obtain the financial report for each company. With the help of Sectors, you can easily access the Company Report, which provides comprehensive information beyond just financial. The available sections of the report include:
- Overview
- Valuation
- Peers
- Future
- Financials
- Dividend
- Management
- Ownership
But in this section, we will only cover the financials section, specifically the revenue and earning data, let’s retrieve the data and merge it into our previous data.
If you run the code and try to print the data
the output should look like this
Now let’s transform the data to pandas dataframe so we can do further analysis and visualization to it.
We now have access to both revenue and earnings data through a single API provided by Sectors! Sectors simplify the process of retrieving each company’s financial report. To explore the breadth of available data, you can interact with the API directly.
Data Visualization
Since we already gathered the revenue and earnings data from each company, now let’s try to visualize and compare the revenue and earnings data from each company
Revenue Comparison
Let’s take a look at a single company revenue first and try to visualize it.
Now we can see that PT Indonesian Tobacco Tbk have a consistent increase in the revenue, this is a good insight. Now let’s take a look at the bigger picture, let’s compare all the company in Tobacco Subsector and also make it much prettier.
Upon comparing the revenue of all companies, it’s evident that Gudang Garam Tbk consistently outperforms with the highest revenue. This valuable insight could significantly enhance your investment decision-making process.
Earning Comparison
To compare earnings between companies, you can easily modify the previous code by replacing revenue
with earnings
. We won’t repeat the code here as it remains largely the same, and we trust in your ability to make this straightforward change.
We see that HM Sampoerna Tbk consistently have the highest earning compared to all companies.
Conclusion
The Sectors app simplifies the process of retrieving company data. We’ve demonstrated its use by visualizing and comparing company revenue and earnings. However, the Sectors Financial API offers much more. This is merely an example of its potential; there’s a wealth of data at your disposal. Feel free to explore and utilize it according to your needs.