GET CONSTITUENTS OF AN INDEX USING PYTHON CODE

Hemant
Hemant Newcomer

How do I get the constituents of nifty 50 which is depicted by INNSE50 or .NSEI , I can see that on the datastream navigator but i want to extract via python code. I am trying to use this,
df, err = ek.get_data(
instruments = ['INNSE50'],
fields = ['TR.IndexConstituentRIC',
'TR.IndexConstituentName'],
parameters = {
'SDate':'2025-08-20'
}
)

Best Answer

  • Gurpreet
    Gurpreet admin
    Answer ✓

    Hello @Hemant

    You can use the chain RIC 0#.NSEI and get its constituents using the LD Library -

    import lseg.data as ld
    from lseg.data.discovery import Chain
    
    ld.get_data(Chain('0#.NSEI'), fields=['TR.CommonName'])
    

    and the results show the constituents -

    image.png

Answers

  • Hemant
    Hemant Newcomer

    Thanks @Gurpreet, How Can we also get the member weightages currently and historically?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Hemant

    This forum is dedicated to software developers using LSEG APIs. The moderators on this forum do not have deep expertise in every bit of content available through LSEG products, which is required to answer content questions such as this one.

    The best resource for content questions is the Helpdesk support team, which can be reached by submitting queries through LSEG Support. The support team will either have the required content expertise ready available or can reach out to relevant content experts to get the answer for you.

    You need to ask for the Excel formula, such as =RDP.Data, that can be used to retrieve the required data.

    Then, we can help you converting that formula to Python code. Please include the URL of this discussion in your raised question to prevent it from being redirected back to this Q&A forum.

  • mjabir
    mjabir Newcomer

    How to get the same list for a given date? let's say 01/01/1990

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @mjabir

    The best resource for content questions is the Helpdesk support team, which can be reached by submitting queries through LSEG Support. The support team will either have the required content expertise ready available or can reach out to relevant content experts to get the answer for you.

    You need to ask for the Excel formula, such as =RDP.Data, that can be used to retrieve the required data.