Raising this query in behalf of the external client Giang Le (User ID giang.le@tgm-au.com) from Tactical Global Management Ltd. He is seeking assistance on how to retrieve constituent list and weight for .SPX using Python API
Upgrade from Eikon -> Workspace. Learn about programming differences.
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Raising this query in behalf of the external client Giang Le (User ID giang.le@tgm-au.com) from Tactical Global Management Ltd. He is seeking assistance on how to retrieve constituent list and weight for .SPX using Python API
Hello @romerson.gadil21
Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.
Thanks,
AHS
@romerson.gadil21 please see the code below:
For current constituents/weightings:
df, err = ek.get_data('0#.SPX', ['TR.IndexConstituentWeightPercent.date','TR.IndexConstituentWeightPercent']) df
For historical constituents/weightings you need to add a Sdate parameter:
df, err = ek.get_data('0#.SPX', ['TR.IndexConstituentWeightPercent.date','TR.IndexConstituentWeightPercent'],{'Sdate':'2020-03-12'}) df
I hope this can help. NB Historical constituents are not available for all indices.
Thank you Jayson. My apologies. I missed to add. The client only has delayed access for this RIC. Would it matter?
@romerson.gadil21 I'm not sure - I don't think it should matter as the information is coming from a non-realtime source. Ask the client to try it and see.