Collecting financial data for fundamental analysis
This is the first tutorial of the series Value Investing in Python, which enlightened by Warren Buffett’s value investing principles summarized in his article: 1977 Berkshire Hathaway Shareholder Letter.
In this section, there are 3 learning objectives:
- Understand the basic concept of value investing and intrinsic value
- Understand what data will be needed to calculate the intrinsic value
- Learn to collect the financial data needed from future use
What is value investing?
Let’s start this section by talking about what is value investing, just so to give you a sense of what data will be needed to conduct value investing. If you have never traded a stock or have no idea how the stock market works, here is a great video:
In terms of stock trading, there are 2 important concepts: price and value. They are related to some extent but inherently different. Price is decided by sellers and buyers of a stock, which represents their temporal confidence in a company. Value, more precisely, intrinsic value, is a measure that represents how much does the company worth based on its performance and prospects. While the price of a stock is obvious and volatile, the intrinsic value of a stock is not apparent but relatively stable. The fig1 shows the relationship between price and value.
As you can see, the fluctuation of price gives us a chance to buy a stock when it’s undervalued. One way to figure out whether it is the good timing to buy in stock is by calculating its intrinsic value and compare with the current price.
What is intrinsic value?
After the previous discussion, you may be wondering what the intrinsic value really is. Here is a great video that would give you the idea.
In short, the intrinsic value can be understood as “The cash that can be taken out of a business during its remaining life.” by Warren Buffett.
To do the calculation, according to the video, we can assume the company is going to operate in the same way as they did in the last 10 years, and we only consider the next 10 years. Then, the intrinsic value can be divided into 2 parts:
- Total Dividends in 10 years
- Book Value of Equity Per Share in 10 years
You can refer to the link for further explanation of the financial terms. And if you have difficulties in understanding BVPS (Book value per share), then the following video is going to provide help.
You could learn the definition of ‘Book Value of Equity’ from the following video. In this video, ‘Equity’ is the short name of ‘Book Value of Equity’.
You could learn the definition of ‘Share’ from the following video.
Where to find the data?
As above, the historical financial documents of the company contain the data we need for calculating the intrinsic value of a stock. Here I will introduce 2 ways to collect these data.
The first approach is to download 10 years’ financial document from Morningstar.
Step 1: Go to Morningstar, on the top-right corner of the page search for a stock. Here I used ‘AAPL’ for Apple. And then click the first result of the dropdown list will lead us to a page with detailed information. (If you have no idea about the stock symbol of a company, you could Google with ‘ticker of XX company’)
Step 2: Click the ‘Key Ratios’ tab and then click ‘Full Key Ratios Data’. This will lead us to the financial page.
Step3: Click the ‘Export’ button on the top-right corner, you will get a .csv file which contains all the information we need for fundamental analysis.
As you can see, we have the last 10 years’ Dividends and Book Value per Share (short name for ‘Book Value of Equity per Share’). This is sufficient for us to calculate the intrinsic value of a stock.
The nice things about Morningstar includes:1.It is free, 2.the data is well organized and easy to retrieve. While other sites like Yahoo Finance also offer historical financial data for free, Morningstar is among a few that offer up to 10 years of historical data.
The second approach is to use a financial data provider, IEX Cloud.
You could directly use Python to retrieve the stock data. Apart from financial data, IEX Cloud also offers a lot of different information like historical prices, stock profiles, etc. Their API document contains everything you need.
The flip side is that it will charge you a lot of money if you want to download a lot of historical financial documents. You could register for a free plan with limited data access, which gives you access to ~20 historical financial reports.
In our tutorial, we will be using the Morningstar as our data source.
What next?
In the next tutorial, we will introduce some basic stock index and start calculating them. As they are also important for fundamental analysis, the calculation is easier than that for intrinsic value. In this way, you might feel easier to start with using Python and Pandas for fundamental analysis.
But if you are already a pro in Python and only interested in the intrinsic value calculation, you could directly go to the 3rd part of this tutorial.
If you have any suggestions or feedbacks, please feel free to leave a comment or email me at sz163@duke.edu.
Syllabus: 0. Value Investing in Python
Next tutorial: 2. How to Generate these Popular Stock Terms using Python