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
-
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')
0
Answers
-
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')
You can get more information on parameters like corex, normalize etc, by invoking help:
>>> help(ek.get_timeseries)
0 -
@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?
0 -
Do I understand you correct that you advise me to use get_timeseries for fx rate retrieval as well?
0 -
0
-
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:
0 -
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?
0 -
@Gurpreet perhaps you did not notice my questions above
0 -
BAR - in the financial industry speak refers to the Open High Low Close data points, aggregated over the specified interval.
For the information on the limits of various data calls, please see this limits document for the Eikon API.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛