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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
166 10 17 21

Eikon API: how to add dates to output of 'get_data'?

Question on behalf of a client: how to add the dates (as index) to the output of the following code?

start_date = str(20170801)
end_date = str(20170901)

data, err = eikon.get_data("ACCG.AS", ["TR.PriceTargetMean", "TR.PEG"], parameters= {"SDate":start_date, "EDate":end_date})

Thank you so much in advance for your help!

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
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.

Upvote
Accepted
39.2k 75 11 27

You can add date output to either one or both of these fields by adding the field with .date qualifier. E.g. eikon.get_data("ACCG.AS", ["TR.PriceTargetMean.date", "TR.PriceTargetMean", "TR.PEG"], {"SDate":start_date, "EDate":end_date})

Note that if there's a possibility that the dates for TR.PriceTargetMean and TR.PEG do not align due to gaps in data or some such, you need to request dates for these two fields separately: eikon.get_data("ACCG.AS", ["TR.PriceTargetMean.date", "TR.PriceTargetMean", "TR.PEG.date", "TR.PEG"], {"SDate":start_date, "EDate":end_date})
We're working on an enhancement to introduce master date output column similar to what RH:Date parameter does for =TR function in Eikon Excel.

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.

Upvote
43 3 1 7

@Alex Putkov Thank you for your reply and good to know you are working on an enhancement similar to RH:Date for excel.

The issue with adding "TR.PriceTargetMean.date" is that it only adds the latest known date of a price target update and not the specific dates in between, so using this function still does not solve my issue of finding the price target for all dates between start_date and end_date.

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
39.2k 75 11 27

Try TR.PriceTargetMean.calcdate instead then.

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
43 3 1 7

Great! That's exactly what I needed!

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