GET CONSTITUENTS OF AN INDEX USING PYTHON CODE

Hemant
Hemant Newcomer
edited 10:13AM in Eikon Data APIs

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'
}
)

Answers

  • 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