Animating the Top Stocks by Market Capitalization on IDX
Market capitalization, often referred to as market cap, is a measure of a company’s total value in the stock market. It is calculated by multiplying the current share price by the total number of outstanding shares. In a way, it is the market’s consensus on the value of a company, reflecting both the company’s size and its perceived growth prospects. In Indonesia, it is well observed that the top companies by market capitalization (and hence, value) are the largest banks that command a household level of trust and brand recognition.Analysis
Given the significance of market capitalization in stock assessment, we will examine the evolving rankings of stocks based on their market capitalization values since December 2020 on the Indonesia Stock Exchange. We can directly fetch the historical market capitalization using the Sectors Financial API. To access the API you only need to go to the Sectors website, subscribe to the plan and call the API directly from your script or notebook. Below is the code how to fetch the historical market capitalization data using the Sectors Financial API.date | symbol | market_cap |
---|---|---|
2023-08-31 | ADMR.JK | 5.560000e+13 |
2023-08-31 | ADRO.JK | 8.540300e+13 |
2023-08-31 | AIMS.JK | 6.300000e+10 |
2023-08-31 | AKRA.JK | 2.810300e+13 |
2023-08-31 | APEX.JK | 4.390000e+11 |
Data Wrangling
If you have followed the Top Stock Volume Animation Plot recipe, the code below is more or less the same like the one in that recipe. The differences are the data source and the data cleansing part, since in this recipe the data manipulation parts won’t be that complicated.- Take the top 10 stocks based on the market capitalization value in each month.
- Create a
Rank
variable to annotate the position of each stock each month. - Finally, arrange the dataset by date and market capitalization value in ascending order.
market_cap
value using the previously created formatted number function. Additionally, we will include an image
column containing each company’s logo value for visualization purposes. Finally, we will format the date column for improved visualization.
date | symbol | market_cap | month | year | rank | market_cap_text | image |
---|---|---|---|---|---|---|---|
2020-12-31 | ICBP.JK | 1.116630e+14 | 12 | 2020 | 10 | 111.66T | ”../chart_logo/ICBP.JK.png” |
2020-12-31 | BBNI.JK | 1.140040e+14 | 12 | 2020 | 9 | 114.00T | ”../chart_logo/BBNI.JK.png” |
2020-12-31 | TPIA.JK | 1.618390e+14 | 12 | 2020 | 8 | 161.84T | ”../chart_logo/TPIA.JK.png” |
2020-12-31 | HMSP.JK | 1.750590e+14 | 12 | 2020 | 7 | 175.06T | ”../chart_logo/HMSP.JK.png” |
2020-12-31 | ASII.JK | 2.439130e+14 | 12 | 2020 | 6 | 243.91T | ”../chart_logo/ASII.JK.png” |
2020-12-31 | UNVR.JK | 2.804030e+14 | 12 | 2020 | 5 | 280.40T | ”../chart_logo/UNVR.JK.png” |
2020-12-31 | BMRI.JK | 2.922150e+14 | 12 | 2020 | 4 | 292.21T | ”../chart_logo/BMRI.JK.png” |
2020-12-31 | TLKM.JK | 3.278960e+14 | 12 | 2020 | 3 | 327.90T | ”../chart_logo/TLKM.JK.png” |
2020-12-31 | BBRI.JK | 5.092090e+14 | 12 | 2020 | 2 | 509.21T | ”../chart_logo/BBRI.JK.png” |
2020-12-31 | BBCA.JK | 8.262260e+14 | 12 | 2020 | 1 | 826.23T | ”../chart_logo/BBCA.JK.png” |
Data Visualization
theme
for the plot, which does not affect the underlying data. This code is solely for configuring the visual appearance of the chart. While we can start to create the animated plot by creating the static plot using the code below:
.gif
file:

BBCA.JK
consistently maintains the highest market capitalization on the Indonesia Stock Exchange since December 2020, while other positions fluctuate. For deeper insights into the market capitalization of companies or sectors on the Indonesia Stock Exchange, check out Sectors. Also, stay tune to our next recipes!