Trying to use get_data() to download a series of total returns (TR.TotalReturn)
I am trying to use get_data() to download total return time-series for a selection of RICs. This works fine in excel with the following formula
=TR($E$9:$E$13;"TR.TotalReturn";"Frq=D SDate=2008-01-01 EDate=2018-01-01 CH=IN RH=date";H10)
This gives me a table with dates in the first column and with total return series in the other column, one column per RIC.
However, when I use the formula in Python using the same parameters as in the excel function call, I get a completely different output.
ek.get_data(rics, fields=ek.TR_Field("TR.TotalReturn"), parameters=
{"Frq": "D", "SDate": "2008-01-01", "EDate": "2018-01-01", "CH": "IN", "RH": "date"})
1. Why is this? Can I not replicate the excel output (which I built myself using the Layout button in the Excel Eikon Add-In)
2. Where can I find a description and a list of all possible parameters about the 'parameters' field of the method get_data()?
Thanks for any help!
Best Answer
-
It is not as simple, I am afraid, but the result is returned in a data frame format, that you can change to meet your goals. For instance, we can change your request into this:
df, e = tr.get_data(['AAPL.O', 'TRI.N'], ["TR.TotalReturn.date","TR.TotalReturn.value"], parameters={"Frq": "D", "SDate": "2008-01-01", "EDate": "2018-01-01"})
So, after you got your results into your data frame, you can create a pivot table:
pt = df.pivot_table(values='value', index=['Date', 'Instrument']).unstack('Instrument')
After that, your date index should be recognised as a date:
import pandas as pd
pt.index = pd.to_datetime(pt.index)
pt.reindex()That's it:
To your second question, you can use the Data Item Browser app (DIB) on Eikon, select a field and then choose the parameters tab:
1
Answers
-
Thank you Zhenya. Your answer to my first question helps, I will try this approach.
My second question wasn't about the Eikon Excel AddIn. It was about how to use all parameters, which you can also set in the Eikon Excel AddIn, in the get_data(parameters) function. I can't find a description for it.0 -
@dominique.brandl
Please refer to this tutorial, which talks at length about translating Eikon Excel syntax to get_data call and using Data Item Browser app for metadata discovery (field names and parameters) to use in get_data method.1
Categories
- All Categories
- 6 AHS
- 37 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
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛