Gather data and perform fundamental analysis for a market.
In this article, let’s use our coding skills to evaluate and choose quality stocks. It is fun to collate stock data for a particular market and perform fundamental analyses.
Getting Stock Market Data
I am going to use the
investpy library to gather market information.
Let’s get started!
investpylibrary is a Python library that can be used to scrape market data. In this example, I download a list of US stocks.
- As you can see, there are 4,582 stocks, and efforts to manually select the stocks are going to be tremendous. Let’s see what we can do to shortlist some stocks.
- The dataset is saved to a CSV file for later use.
Choosing the Metrics
There are many metrics that can be used to select good stocks. To make it simple, I am going to use the
price-to-earnings (P/E) ratio and
Let’s get the financial information for each stock using
Now I have basic financial information like EPS, P/E ratio, market capital, revenue, beta, next earnings date, etc for each stock.
Let’s download the dividend history for the stocks.