Value Investing Strategy
By: Gerald Bryan · May 2, 2024
Hello and welcome back to our Sectors animation plot series! If you haven’t already explored our previous recipes and recreated those captivating plots, you’re in for a treat. This series is a showcase of creativity, using the dynamic duo of ggplot
and gganimate
to craft stunning animated visualizations. These plots aren’t just eye candy; they’re the content that keeps Sectors Instagram account buzzing (make sure to check them out and hit that follow button!). Each plot is based on meticulously curated data from the Sectors team, providing insightful analysis, particularly focusing on the Indonesia Stock Exchange. So, without further ado, let’s dive into the excitement of our third recipe in this animation plot series!
Financial Ratio Valuation Metrics
In the last two recipes, we already used the market capitalization and transaction volume to do some analysis. In this recipe, we will use financial ratio to do some valuation on each stock price. There are two financial ratio valuation metrics that we will use here which are Price to Earning Ratio
(PE Value) and Price to Book Value Ratio
(PBV).
PE Value Ratio
The price-to-earnings (P/E) ratio is a metric that evaluates a company’s stock price in relation to its earnings per share (EPS). This ratio is crucial for determining the value of a company’s stock, as it allows for comparisons of a company’s valuation over time, with other companies in the same industry, or with the broader market.
Example: A P/E ratio of 15 means that the company’s current market value equals 15 times its annual earnings.
The P/E ratio serves as a valuable tool for investors to gauge whether a stock is undervalued or overvalues. A high P/E ratio may indicate that the stock is overvalued, suggesting either optimistic growth expectations or inflated market sentiment and vice versa. Additionally, by calculating the median P/E ratio across several years, investors can establish a standardized benchmark to determine a stock’s potential worth.
However, a notable limitation of using P/E ratios arises when comparing companies across different sectors. Variations in valuation and growth rates are common among industries due to differences in revenue generation timing and business models, making direct P/E ratio comparisons less reliable.
PBV Ratio
The price-to-book ratio (P/B ratio) of a company is calculated by dividing its current stock price per share by its book value per share (BVPS). This ratio provides insight into how the market values the company relative to its book value.
Example A P/B ratio of 1 means that the stock price is trading in line with the book value of the company. In other words, the stock price would be considered fairly valued, strictly from a P/B standpoint.
Typically, a P/B ratio below one suggests that a company is undervalued, whereas a ratio above one suggests that the stock is trading at a premium. However, the significance of these values can vary significantly across industries. Different sectors have their own norms, where lower or higher P/B ratios may be considered typical.
However, the P/B ratio has its limitations. For instance, it does not take into account intangible assets such as intellectual property and brand value, which can be significant in certain industries. As a result, the P/B ratio may not always accurately reflect a company’s true value. Furthermore, the P/B ratio may be less relevant for companies with a high proportion of intangible assets, such as technology firms, where the value lies more in ideas and innovations than in physical assets.
Plot Creation
After reading about the financial ratios valuation metrics, now we can start to play with the data and create a animated plot to shown the comparisons of the financial valuation metrics (PE and PBV) of some major banks in Indonesia.
Data Fetching
To get the data you can use Sectors Financial API to directly fetch the data from the Sectors website, it will be easier for you to directly ping the API and use the data than curated the data by yourself, so don’t forget to subscribe to Sectors Financial API plan. Here is the code to fetch the historical valuation data using the API.
The code above will fetch the historical valuation data from the top 8 major banks in Indonesia. If you want to analyze other industry, you can change the list of stocks you want to fetch in the stocks
list. Finally, here is the result of the fetching code.
symbol | year | pe | pb | pe_peer_avg | pb_peer_avg |
---|---|---|---|---|---|
BBCA.JK | 2020 | 30.45000 | 4.4800000 | 27.29648 | 1.2624248 |
BBCA.JK | 2021 | 28.35000 | 4.3900000 | 15.01456 | 1.4663059 |
BBNI.JK | 2022 | 9.30000 | 1.2500000 | 15.12926 | 1.0085239 |
BBNI.JK | 2023 | 9.30000 | 1.3000000 | 13.15047 | 0.7844267 |
BBRI.JK | 2020 | 27.30000 | 2.2400000 | 27.29648 | 1.2624248 |
Additionally, I also already provide the dataset in case you haven’t subscribe to Sectors Financial API plan. The data that is used here is provided by Sectors. However, don’t forget to register and subcribe to Sectors Financial API for more effective way of doing stock market (especially Indonesia’s Stock Market) analysis.
Data Manipulation
In the data there are pe_peer_avg
and pb_peer_avg
columns which are the Sectors PE ratio and PBV ratio in each year and every symbol will have the same value if the year is the same. Therefore, we will convert those value and bind it into our data using the code below.
and here is the glimpse of the final data that we produced using the code above:
symbol | year | pe | pb |
---|---|---|---|
Banks Sub-Sector | 2020 | 27.29648 | 1.2624248 |
BBCA.JK | 2020 | 30.45000 | 4.4800000 |
BBCA.JK | 2021 | 28.35000 | 4.3900000 |
BBNI.JK | 2022 | 9.30000 | 1.2500000 |
BBNI.JK | 2023 | 9.30000 | 1.3000000 |
BBRI.JK | 2020 | 27.30000 | 2.2400000 |
Data Visualization
Same like before, we will create a custom theme for our plot just for the content purpose, you don’t need to use this custom theme if you don’t want to.
Now let’s dive to the creation of stock financial valuation plot. There will two static plots and one animation plot in this recipe. First, let’s dive into the creation of the static plot.
Yearly Plot
Usually, we compared the PE and PBV ratio for same stock in different time to see whether a stock is overvalued or undervalued compare to their historical valuation. Therefore in this section, we will try to make a plot that see the difference between PE and PBV ratio for BBCA.JK
from year 2020 to 2023 using the code below.
Using the code above, the image below is the plot result. From the plot we can see that in 2023 BBCA.JK had the highest PBV ratio but also had the lowest PBV ratio. We can use this for further analysis determine the value of BBCA.JK.
Sectors plot
Another analysis that we can use to determine a value of a stock is by compare it to another stock in the same sector or compare it to the Sectors average. The code below will make a plot that enable that analysis.
and here is the result of the code above:
Animation Plot
Using the two plots above that create the plot for comparisons of PE and PBV ratio of one company over the years, and the plot to compare PE and PBV ratio of some companies in one sector in one year. We can combine it to create a plot that show the PE and PBV ratio comparison of some companies in a sub-sector over the years. And, we will create an animation plot to achieve that. Here is the code to create the static plot first before we configure the transition and create an animation plot.
After creating the plot, now we will try to animate that plot, in this animation we will animate the value of each companies PBV and PE ratio value by year. The data we have are PE and PBV ratio value from 2020 to 2023, therefore we will have a plot that animate the PE and PBV value of each companies from 2020 to 2023. Last step, save the animated plot into .gif
file.
and here is the final result of our plot:
Therefore, by examining the above plot, we can assess the evolution of valuation for each company in the banking sector over time, both in comparison to other companies within the industry and against the sector/industry as a whole. It is hoped that this article has provided you with insights and perhaps inspired you to create your own animated plot.
Also, remember to visit Sectors’s website for further information and analysis of Indonesian stock market data.
We look forward to see you in the next installment of the animation plot recipe series!