How can I find the component of indexes like the S&P 500 or the Sub Index and access them in Python through the jupyter notebook?How can I write a define a screener and have the results returned in a jupyter notebook?
Hi @nikolas - Thank for your question. Refinitiv maintains a number of chain RICs which provide the constituents of many indices as well as options and futures chains. Please use the following code to get the constituents of the SPX.
df,err = ek.get_data(['0#.SPX'], ['CF_NAME'])df
To find the chain RICs for subsectors you can just add a 0# infront of say .SPLRCTELP which is the Integrated Telecommunications Services sub index.
I hope this can help.
@nikolas just add the fields in as you want - you can see a full list of fields available using the Data Item Browser App (type DIB into Eikon search bar):
df,err = ek.get_data(['0#.SPLRCTELP'], ['CF_NAME','TR.CompanyMarketCap'])df
@nikolas and if you want to do more complicated screenings based on multiple criteria please see this article on how to use the screener to generate a universe and then pass that as an instrument list to the get_data API call.