top of page

Python Script to Download 10 Year of Historical Data on 500 Companies in Yahoo Finance

The question is "How do I download all 500 companies in the S&P 500 for daily data" including:

Date Open High Low Close Adjusted Close Volume Company Name Ticker Symbol Previous Close Average Volume Market Capitalization

I anticipate it would take 40 hours at least to go into a platform, load the chart and export the data to a separate txt file for each of the 500 stocks in the S&P 500.

Using Python and Yahoo finance, I wrote a script to do it in a few minutes. 

If you have never used Python before, do a search on How to Install an Anaconda environment and How to Install Spyder.

I prefer Spyder to run python scripts.

As part of the installation, it is important to run the following lines in the Anaconda environment.

pip install pandas pip install yfinance

You can then copy and paste this script into Spyder to get all the text files.

SP 500 Yahoo Finance
Download IPYNB • 2KB

42 views0 comments

Recent Posts

See All


bottom of page