How could I get the isin code of S&P500 constituents on a specific date?

I can get RIC by using: eikon.get_data('.SPX', ['TR.IndexConstituentRIC' , 'TR.IndexConstituentName'], {'SDate':'20180501'})[0]

How could I get the isin code directly? apparently, 'TR.IndexConstituentISIN' does not work.

Thanks!

Best Answer

  • chavalit-jintamalit
    Answer ✓

    Hi @pengxin1211

    You can make another calls to get ISIN code.

    image

    df=ek.get_data('.SPX', ['TR.IndexConstituentRIC' , 'TR.IndexConstituentName'], {'SDate':'20180501'})[0]
    riclist = df['Constituent RIC'].tolist()
    df2=ek.get_data(riclist, 'TR.ISIN')
    print(df2)

Answers

  • Hi @pengxin1211,

    There is an equivalent alternative to Chavalit's code, using get_symbology instead of get_data for the second call:

    df=ek.get_data('.SPX', 'TR.IndexConstituentRIC', {'SDate':'20180501'})[0]
    riclist = df['Constituent RIC'].tolist()
    df2 = ek.get_symbology(riclist, from_symbol_type='RIC', to_symbol_type='ISIN')
    df2

    Note: parameter from_symbol_type is optional (it defaults to RIC).