For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted
51 0 2 1

Using API to pull the historical index constituents during a period of time

Is there a way to use API to pull the historical index (eg. ASX 200 Index) constituents during a period of time (eg. 1/1/2016-12/31/2016)? I know we can pull on a daily basis by using "= tr.get_data("0#.AXJO(2016-08-09)","TR.CommonName")", but can we do for a period of time? This is the entire reason I am using the API

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonhistoricalindexconstituents
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
18k 21 12 20

Hi @yiyezhou and @charleszhou

It is not possible to directly retrieve the index on a date range.

Here is the explanation from @Alex Putkov.

So basically, you have 2 ways to achieve this:

1. Loop your code from start_date to end_date and call get_data

df, e = ek.get_data('0#.SPX(2016-01-01)','TR.RIC') #then keep the data to your local variable
df, e = ek.get_data('0#.SPX(2016-01-01)','TR.RIC') #then keep the data to your local variable
...
...
df, e = ek.get_data('0#.SPX(2016-12-30)','TR.RIC') #then keep the data to your local variable
df, e = ek.get_data('0#.SPX(2016-12-31)','TR.RIC') #then keep the data to your local variable

Please note to beware of API call limitation too.

2. Get the constituent on the start date and get joiner and leaver from start date to end date and apply them locally in your code:



ahs.png (39.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 0 0

I have the same question here. It will be really helpful if Eikon API can do that. It is a really common function to use in the industry I am working in.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea