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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 1 3

Earnings release dates & period end dates in 1 request?

date , err = ek.get_data(["KGC.N"], ["TR.EventType(EventType=RES).date", "TR.EventType(EventType=RES).companyevent"], {'SDate':'2010-01-01', 'EDate':today})

I'm trying to get Earning Release dates historically, which is achievable using the above command. However, I wish to also have the associate end of quarter for each earnings release as an additional column. I consulted Eikon Excel support and they provided me with:

=TR("AAPL.OQ","TR.EventType;TR.EventType.date;TR.PreferredMeasureActValue.periodenddate","SDate=2016-01-01 EDate=-1W EventType=RES Frq=FQ Period=FQ0 CH=Fd RH=IN",B6)

This return exactly what I want in Excel by tying the period end date which TR recieved an Actual to the earning release date. I'm sure it is possible within the API, but I'm struggling to replicate.

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

Note that I defined 'today' using:

import time as t
today = t.strftime("%Y-%m-%d")

1 Answer

Upvote
Accepted
39.2k 75 11 27

get_data method has very similar syntax to =TR Excel worksheet function. The first argument is instruments, the second is field names, the third is parameters. The difference is that in Excel the values of the arguments are strings or cell references, in Python they are lists and dictionaries. There are also subtle differences like RH and CH formatting parameters, which control what is returned as row and column headers in the resulting table, are only supported in Excel. get_data method ignores these parameters. But overall, if you have an =TR function, it's pretty straightforward to replicate it using get_data method.
Here's the get_data call equivalent to =TR function you were given

ek.get_data(['AAPL.OQ'],['TR.EventType','TR.EventType.date','TR.PreferredMeasureActValue.periodenddate'],{'SDate':'2016-01-01','EDate':
'-1W','EventType':'RES','Frq':'FQ','Period':'FQ0'})
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.

Thank you! I've had trouble before combining more than one field, so that explanation and call structure is very helpful

Click below to post an Idea Post Idea