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:
Hi,
Thank you for your participation in the forum.
Is the reply below satisfactory in answering your question?
If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question.
Otherwise please post again offering further insight into your question.
Thanks,
AHS
Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
AHS
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: