component of indexes like the S&P 500 or the Sub Index

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?

Best Answer

  • 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

    image

    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.

    image

    I hope this can help.

Answers