Sign In

Scraping Stocks Pe

Web scraping Software companies for valuation using Python

Comparing Price-Earning Ratios of the stock to the Industry average Price-Earning Ratios to determine valuation\color{grey}{\text{Comparing Price-Earning Ratios of the stock to the Industry average Price-Earning Ratios to determine valuation}}


In the midst of the COVID-19 pandemic, strikingly large number of software companies were able to profit and generate revenue never seen before. Whether it was the transition to a work from home enivironment, the aid from the government stimulus check, or the growing consumer demand produced through the increasing money supply by the Federal Reserve, valuation of companies across the entire market are well beyond expectation.

To gain perspective from a fundamental point of view, one of the many tools that can be used to be determine a company's valuation is through their Price-Earning Ratio over the past year. The Price-Earning Ratio (PE Ratio) compares a Company's share price relative to their Earnings per share and enables investors to compare the ratio to the Industry Average PE ratio to determine whether a company is overvalued or undervalued, with a high PE ratio illustrating the company to be overvalued and a low PE ratio to be undervalued.

In this project, scraping Top Foreing Stocks and Yahoo Finance, the following steps will be taken to achieve the list of overvalued and undervalued software companies:

  • Install all the necessary Python Libraries
  • Find the list of all the software companies in Top Foreing Stocks
  • Retrieve the PE-Ratio of each software companies through Yahoo Finance using Beautiful Soup
  • Calculate the industry average PE-Ratio using the PE-Ratios from all the companies
  • Generate list of dictionaries containing Company ratios and their valuation
  • Compile the information into a csv file

Installing all the libraries

To begin scraping our data, we will rely on the few of the libraries below with their different capabilities to reach our end goal.

  • The jovian library enables us to save new versions of the notebook.
  • The Requests library allows us to connect to the web-page server and retrieve the content in the web-page.
  • With the help of the Beautiful Soup library, we will extract the pertinent data, in our case, the PE Ratios.
  • And finally, with the Pandas library, we will parse the data into a CSV file.

While installing the libraries below, the upgrade command provides us with the latest update of the libraries where as the quiet command hides the unncessary output generated during the installation process

anishthomas7476 months ago