Translating Refinitiv Excel Formula to Eikon Python API

I have an excel plugin formula which I want to convert to Python Code and get the same result via eikon Python API.
My excel formula is : =@RHistory("DEBMK2;DEBMM2;DEBMN2;DEBQN2;DEBQV2;DEBQF3;DEBYF3;DEBYF4;DEBYF5;DEBYF6;DEBYF7;DEBYF8;DEBYF9;DEBYF0",".Timestamp;.Close","NBROWS:365 INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd",B27)
I used ek.get_timeseries method but it is showing error for few tickers in the list. I was told I can get the same output using ek.get_data method. But I unable to find the correct params for this.
I tried the following code but it is not working for me:
df, err = ek.get_data(['DEBMc1', 'DEBMc2', 'DEBMc3', 'DEBQc1', 'DEBQc2', 'DEBQc3', 'DEBYc1', 'DEBYc2' , 'DEBYc3' , 'DEBYc4' , 'DEBYc5' , 'DEBYc6' , 'DEBYc7' , 'DEBYc8' ],
['TR.Timestamp','TR.Close'], {'SDate' : startDate, 'EDate': reportDate})
Where startDate and reportDate are defined elsewhere.
Can someone explain me how to find relevant fields to be provided here?
Best Answer
-
Hi @Mohit.Rai
Using the refinitiv-data library, you can try this:
import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
# Within CodeBook, this will automatically use the Desktop Session
rd.open_session()
...
items = ['DEBMc1','DEBMc2','DEBMc3','DEBQc1','DEBQc2','DEBQc3',
'DEBYc1','DEBYc2','DEBYc3','DEBYc4','DEBYc5','DEBYc6',
'DEBYc7','DEBYc8']
response = historical_pricing.summaries.Definition(
universe = items,
start='2021-05-01',
end='2022-06-08',
fields=['SETTLE']
).get_data()
response.data.dfThe 'SETTLE' field is defined as the official closing price. In addition, there are no duplicates in this data set. As suggested, I would follow up with the helpdesk to confirm the content.
0
Answers
-
You can try ['TR.ClosePrice.Date','TR.ClosePrice'] fields.
df, err = ek.get_data(['DEBMc1','DEBMc2','DEBMc3','DEBQc1','DEBQc2','DEBQc3','DEBYc1','DEBYc2','DEBYc3','DEBYc4','DEBYc5','DEBYc6','DEBYc7','DEBYc8' ],
['TR.ClosePrice.Date','TR.ClosePrice'], {'SDate' : '2021-05-01', 'EDate': '2022-06-08', 'FRQ':'D'})However, I found duplicated entries.
The =TR function in Eikon Excel also returns the same duplicated entries. The get_data method can be used to retrieve the same content as the =TR function in Eikon Excel. Therefore, you need to contact the Eikon Excel support team directly via MyRefinitiv to verify the content. You may ask for the =TR formula in Eikon Excel which can be used to get the required data. Then, you can apply it to the get_data method.
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
- 616 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 中文论坛