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:
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:
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: