Hello , How to get S&P500 all stock historical daily data and weight by eikon with python API ? thank you.
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.
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: