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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
54 1 1 7

How could I implement the formula in Python Data Eikon API?

I have the following formula:

=RHistory("CR.N","TRDPRC_1.Close; TRDPRC_1.Timestamp","START:01-Jan-2022 END:09-Nov-2022 ADJUSTED:YES INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd",C2)

How could transform it correctly to the Python Eikon Data APi code?

And one more question. Is there any chance to convert the prices into USD easily via Python in this case? I know that in the formula builder it is not possible not in RHISTORY.


I am asking not only for CR.N but in general for a lot of other RIC-codes as well.


Thanks!

eikon-data-apipython#technology
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.

Upvote
Accepted
17.2k 47 13 19

@alekseenkova.marina,

There is no automatic means of currency conversion to USD. You will have to pull the timeseries data for the FX conversion yourself and apply the conversion factor in your code. Regarding adjusted parameter - please see the help for get_timeseries method.

Here is an example of getting data for a CAD instrument and the USD conversion rate:

ek.get_timeseries(['TD.TO', 'CAD='],  fields=['CLOSE'], corax='adjusted', start_date='2022-01-01T00:00:00', end_date='2022-11-09T00:00:00', interval='daily')


1668701642867.png


1668701642867.png (35.8 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.

thank you!


Do I understand you correct that you advise me to use get_timeseries for fx rate retrieval as well?

What is the difference between rd.get_data and ek.get_timeseries?

get_timeseries can only provide historical BAR data.

get_data is a generic API call and can provide variety of data sets, including a limited amount of historical data on the fields which support history. You can see these fields in the Data Item Browser in the Eikon/Workspace. In the DIB, select the field and then select Parameters. If the field supports history (e.g. TR.CLOSEPRICE), then there will be a Series option available:

1668704832955.png

1668704832955.png (16.7 KiB)

1) get_timeseries can only provide historical BAR data


What do you mean by BAR?


2) including a limited amount of historical data on the fields which support history.

What are the limits?

Show more comments
Upvotes
17.2k 47 13 19

Hi @alekseenkova.marina,

There is no equivalent of RHistory in the Python API. Python provides a get_timeseries function which can provide OHLC bar data for different intervals, but the data set and history depth is limited.

Try something like:

>>> ek.get_timeseries('CR.N',  fields=['CLOSE'], start_date='2022-01-01T00:00:00', end_date='2022-11-09T00:00:00', interval='daily')

1668610641514.png


You can get more information on parameters like corex, normalize etc, by invoking help:

>>> help(ek.get_timeseries)



1668610641514.png (16.4 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.

@Gurpreet, thank you for the answer!


In the formula you provided I do not see this parameter: ADJUSTED:YES

How could we add this to the ek.get_timeseries('CR.N', fields=['CLOSE'], start_date='2022-01-01T00:00:00', end_date='2022-11-09T00:00:00', interval='daily') ?


And what about currency conversion?


What is the difference between ek.get_timeseries and rd.get_data for time series retrieval?