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:
0
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.
0 -
@chavalit-jintamalit @Alex Putkov.1 thank you very much. Your answers perfectly explain my confusion.
Best,
David
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 中文论坛