Extract weights of index constituents using DataStream API/DSWS Wrapper on Python

How do I fetch the weights of each constituent of an index e.g. S&P500.

I can get the list of constituents as seen in this thread, but I cannot find a field corresponding to weight:

https://community.developers.refinitiv.com/questions/83971/can-i-use-datastream-api-dsws-to-collect-historica.html


Tagged:

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @prakhar

    You can use the WTIDX data type that represents "% Weight Of Each Constituent Within The List". You can access Datastream Navigator to search for instruments and data types.

    The code looks like this:

    df = ds.get_data("LFTSE100|L",['MNEM','WTIDX'], kind=0)
    df.pivot(index='Instrument', columns='Datatype')['Value']

    The output is:

    1654573881632.png