Historical Index constituents Python API

Hello, I am looking to build a query that returns an Index constituents for a given date, historically, using the Python API eikon package.

I am using the following code:

df, err = ek.get_data(
instruments = ['0#.SPX'],
fields = ['TR.IndexConstituentRIC',
'TR.IndexConstituentName'],
parameters = {
'SDate':'1996-01-02'
}
)

However, the above works up to year 2000 or so, but returns bad request for, e.g., 1996.

The objective for me is to retrieve the components, yearly, all the way back to 1980's and for the SP500 and FTSE All World Indexes.

How would i do so?


Many thanks

Best Answer

  • @mihalis.panczyk Thanks for your question - so historical index constituent coverage varies by index - this is a more detailed content question and is best checked with the appropriate content team by raising a ticket on Contact Us marking it a Content Query. Be sure to put all the RICs you want the earliest dates for and they will be able to check those for you. Your code is of course working fine. I hope this can help.