Descrepancy total return using EIKON API and Excel
Hello,
I am trying to pull quarterly returns for a list of stocks (the ISIN below is just and example) using the EIKON API. This is the code I am using:
for i in range(1995, 2020):
for z in range(1, 5):
ek_d, err=ek.get_data("DK0010302488",["TR.TotalReturn","TR.TotalReturn.date","TR.TotalReturn3Mo"],{"SDate": str(z)+"QCY"+str(i), "CURN": "DKK"})
I am running intwo to issues:
1) the results are very different than if I run the following formula in Excel: =TR("DK0010302488","TR.TotalReturn;TR.TotalReturn3Mo;TR.TotalReturn.date","Frq=CQ SDate=2014-01-01 EDate=2015-12-31 Curn=DKK CH=Fd RH=IN",G4)
2) Values "TR.TotalReturn" and "TR.TotalReturn3Mo" are very different for the same quarter when I use the API, while they are always the same when I use Excel.
I would be very grateful if you could help me figure out what is wrong
Best,
David
Best Answer
-
Hi @dpi.eco
You can directly transform Eixon Excel formula to Eikon Data API call:
fields = ["TR.TotalReturn","TR.TotalReturn3Mo","TR.TotalReturn.date"]
parameters = {"SDate": "2014-01-01", "EDate":"2015-12-31", "Frq":"CQ", "CURN": "DKK"}
ek_d, err=ek.get_data("DK0010302488", fields, parameters)
ek_dThis should give you the same result:
2
Answers
-
To add to the response by @chavalit.jintamalit, when you only specify the value of SDate parameter, TR.TotalReturn returns 1 day total return as of the date corresponding to the value of SDate. This is why the values of TR.TotalReturn and TR.TotalReturn3Mo retrieved in your example using Eikon Data API library are different. When you specify both SDate and EDate, the value of TR.TotalReturn represents total return between these dates. When you retrieve timeseries of TR.TotalReturn by specifying SDate, EDate and Frq, the interval between SDate and EDate is broken into periods according to the value of Frq, and the value of TR.TotalReturn retrieved for each period represents total return between the start and end date of the period. This is why with Frq=CQ the values returned for TR.TotalReturn and TR.TotalReturn3Mo are the same.
2 -
@chavalit.jintamalit @Alex Putkov. thank you very much. Your answers perfectly explain my confusion.
Best,
David
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛