Hello , How to get S&P500 all stock historical daily data and weight by eikon with python API ? thank you.
Hi @ethan.hayashi
You can follow this code to get S&P500 RIC list and get historical data:
(Because the get_timeseries accept up to 300 RIC so I have to split the list into 2 lists before calling the API)
As for weight, I do not understand the content you are trying to retrieve, please clarify or show me the sample data on the Eikon Desktop. I will try to see if it is accessible from API and will share the result.
Thanks.
I would like to share some idea to calculate weight.
1. Get all constituents
2. Get individual market cap
3. Sum market cap
4. calculate weight for each individual stocks against total market cap.
This is example code:
Hi @chavalit-jintamalit,
Thank you for your share .
One more question.
How can I add "date" everyday data , Thank you.
[Instrument] [DSPLY_NAME] [DATE] [Company Market Cap] [Weight]
========================================================
MSFT.OQ MICROSOFT CP/d 2019-08-29 1.0546e+12 3.946080310382849