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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

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

1 Answer

Upvotes
Accepted
39.2k 75 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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea