you can get S&P 500 historical constituents
https://en.wikipedia.org/wiki/List_of_S%26P_500_companies
get the add and remove date,
and you can use python to pull the list from Yahoo systematically.
Most yahoo data can go back as far as 1970.
import pandas_datareader.data as web
import pandas as pd
pd.set_option('display.max_columns', None)
data = web.get_data_yahoo('SPY', '01/01/1997', interval='m')
print(data)
for a school project, you can consider using SPY instead. SPY is very closely follows the S&P500 index.
There are a couple of things you might want to watch out for:
- Some of the underlying tickers might change names, due to different financial events.
- Some of the tickers' first add date might not be available.
the following is the output from the code.
High Low Open Close Volume Adj Close
Date
1997-01-01 79.687500 72.750000 74.375000 78.406250 4.362370e+07 50.724728
1997-02-01 82.000000 77.125000 78.718750 79.156250 3.002880e+07 51.209930
1997-03-01 81.796875 75.250000 78.750000 75.375000 3.751430e+07 48.763680
1997-04-01 80.687500 73.312500 75.250000 80.093750 5.767930e+07 52.014885
1997-05-01 85.562500 79.312500 80.218750 85.156250 3.747340e+07 55.302582
... ... ... ... ... ... ...
2021-02-01 394.170013 370.380005 373.720001 380.359985 1.307806e+09 379.118286
2021-03-01 398.119995 371.880005 385.589996 396.329987 2.401716e+09 395.036163
2021-04-01 420.720001 398.179993 398.399994 417.299988 1.462028e+09 417.299988
2021-05-01 422.820007 404.000000 419.429993 416.579987 8.737502e+08 416.579987
2021-05-14 417.489990 413.179993 413.209991 416.579987 8.220163e+07 416.579987
[294 rows x 6 columns]