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

Upvotes
Accepted
1 2 5 5

Equivalent of an Excel TR Formula in Eikon Python

Hi!
I want to get similar result as the following TR Excel Formula :

=TR("RELI.NS","TR.BasicNormalizedEps","Period=FY0 Frq=D SDate=20200101 EDate=1d CH=IN RH=calcdate",B2)

I've written the following code for it so far :

rics = ['RELI.NS']
fields = ['TR.BasicNormalizedEPS']
params = {'SDate':'2021-01-01', 'EDate':'1d','FRQ': 'D', 'CH':'IN', 'RH':'calcdate'}
res = ek.get_data(rics, fields, params)

Problems :

  1. In place of each occurrence of RELI.NS i want the date of respective trading day to appear
  2. In place of header "Basic Normalized EPS", I want the ric name, ie RELI.NS (as in excel output)

Please suggest how can I do so.

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apiapi
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.

@anshulmlhtr

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the appropriate reply.


This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.


Thanks,

AHS

@anshulmlhtr

Hi,

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
39.4k 77 11 27

RH and CH formatting parameters available in =TR function in Excel are not available in get_data method of Eikon Data APIs.

To retrieve the dates corresponding to the values of TR.BasicNormalizedEPS field, add TR.BasicNormalizedEPS.calcdate to the list of fields in your data request.

fields = ['TR.BasicNormalizedEPS.calcdate','TR.BasicNormalizedEPS']

If you'd like to change the label of a column in the dataframe returned by get_data method, use pandas capabilities.

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.