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

question

Upvote
Accepted
51 2 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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apihistoricalindexconstituents
icon clock
10 |1500

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

Upvotes
Accepted
18.2k 21 13 21

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 512.0 KiB each and 1.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 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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