Is the Nasdaq 100 index overpriced from a value investor’s point of view? That is a legitimate question to ask yourself before considering buying a Nasdaq 100 ETF or a similar asset.
This article aims to provide a tentative answer to the aforementioned question and, more importantly, to expose a methodology in Python that you might want to reuse for other indices.
If you are only interested in the results, skip to section 4!
The stock data is scraped from Yahoo! Finance using the _yahooquery _library and is considered to be correct and accurate without any further verification.
The data was downloaded on February 16, 2021, and it has likely evolved a lot when you are reading this article.
This story is not investment advice.
Nasdaq 100 tickers can be scraped from websites like https://www.cnbc.com/nasdaq-100/ and saved into a csv file.
Should you need help to scrape data from the internet, step 1 of the following story provides a methodology: https://medium.com/analytics-vidhya/how-to-find-the-correlation-between-the-s-p500-and-the-economic-calendar-using-python-7c29c4faa8ff.
Once the tickers are saved, they are loaded into a Pandas data frame and the available information about the companies are downloaded from Yahoo! Finance:
import pandas as pd
from yahooquery import Ticker
#Load tickers and drop duplicated companies
path = "/your/path"
tickers = pd.read_csv(path + "ndx_tickers.csv")
tickers = tickers.set_index("Ticker")
tickers = tickers.drop(index=["GOOGL","FOXA"])
#download companies data from yahoo finance
infos_tickers = Ticker(tickers.index.values)
infos_tickers = infos_tickers.all_modules
Note: Some companies like Alphabet issue shares of different classes that have their own tickers but only one ticker per company is required.
#programming #investing #python #data-science