Analyzing Stock Screener Data for Investing
The world of investing has always been fraught with a myriad of choices and decisions one must make to succeed. Everything from what financial products to invest in to when to purchase or sell. Stock screeners have been a tool that has made it easy to filter stocks based on user-defined metrics. I wanted to scrape data from a stock screener named "Finviz" in order to explore the stocks in the "New York Stock Exchange" (NYSE).
The objective of this web scraping project was to visualize the important data sets one must examine when an individual such as a portfolio manager is deciding what type of stocks to invest in over the long term.
All data the was scraped from the stock screener located at Finviz.com. The filter was set to extract information from the NYSE. This resulted in 4353 rows of data with 11 different columns. "Scrapy" was used as the means of extracting the data.
- No (Number)
- Market Cap
How many stocks are in each sector of the NYSE?
The financial sector is the sector with the greatest number of stocks. An investor looking to diversify a portfolio must make sure they do not over-invest in the financial sector.
What are the 5 top countries represented in the NYSE?
The top five countries in the NYSE are the USA, Canada, China, the United Kingdom and Brazil. An investor would get a better an idea of how to diversify a portfolio internationally and which countries to focus on. Nevertheless, the USA makes up a large portion of the NYSE.
What are the five (5) most popular industries?
What are the PE ratios in the NYSE?
PE ratios are price earning ratios and they are used to measure the share price of a stock relative to the annual net income earned by the firm per share. A high PE ratio usually means a stock is overvalued whereas a low PE ratio means the stock is undervalued.
The above chart has removed all PE ratios that are 0 or negative resulting in the highest range of PE ratios in the 15 to 20 range.
Examining sectors with respect to PE
It is a good idea to examine the relationship between the PE ratios and respective sectors of the economy. This would give an investor a good idea of which sectors are undervalued and overvalued.
All sectors except for the "financial sector" and "conglomerate sector" have an interquartile range between 0 and 22. The conglomerate sector has a few outliers but no interquartile range showing. The financial sector is also not showing an interquartile range but rather a spattering of PE values between approximately 22 to 50.
Analyzing the relationship between price, PE and the sectors
The chart above shows the relationship between the price of each stock, the PE (price earnings ratio) and the relative sectors. This visualization makes it easy for an investor to determine how to invest by analyzing 3 of the most useful variables one must consider when creating a portfolio.
To make the relationship easier to analyze, we scale the x-axis to log scale in the chart below:
One can see the financial sector seems to dominate most of the chart.
In conclusion, our use of "Scrapy" and data visualization has allowed us to gain a greater understanding of the data one must consider when investing. The NYSE data we examined seemed to be primarily concentrated by financial stocks in the USA with the largest number of stocks having a PE range between 15 and 20.
Our key takeaway from this project is that our scraping and data science tools would definitely be important in analyzing and increasing profitability for anyone looking to invest in the stock market.