How to get stocks in SP500 index at a given time
-
The data has more than 500 stocks. I know it includes stocks that used to belong to SP500. For instance for (2026, 2, 24):
from qnt.data import stocks_load_spx_list len(stocks_load_spx_list(min_date='2026-02-24', max_date='2026-02-24'))gives 842.
Filtering NaNs gives me 658 stocks, which is still more than 500.
For a given date, I'd like to exclude the weights for those that are out (no forward-looking involved).