Skip to content

bkestelman/sp500_historical_components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sp500_historical_components

Historical components of the S&P500 and other indexes.

Check out my tutorial on how this works: https://medium.com/@beni.kestel001/how-to-get-historical-s-p-500-components-using-wikipedias-api-8ef58f657c4f

Many sources give the current components of the S&P500, but the historical components are hard to find for free. At the same time, many blogs show how to get the current components yourself from Wikipedia, but for historical components they rely on Wikipedia's list of selected changes, which is far from complete.

Here, we fill this gap by looking at Wikipedia's revision history to get the historical components.

Problems and Disclaimer

The Wikipedia lists sometimes have errors and are not always up to date. Check the data for anomalies and use at your own risk.

How it Works

The current S&ampP500 components are listed on Wikipedia at List of S&P500 companies. Since Wikipedia saves the full revision history for every article, if we want to see what the S&P500 components were in October 2015, we just need to access any revision from around that time. We can do this using the MediaWiki API.

About

Historical components of the S&P500 and other indexes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages