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!

Best Answer

  • Gurpreet
    Gurpreet admin
    Answer ✓

    @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

Answers