How to insert a date column with rd.get_data

Hello everyone
I would like to get a time series with get_data. I would like to have the P/E ratio of the last 3 years.
I use the following code:
import refinitiv.data as rd
rd.open_session()
df = rd.get_data(
universe = ['LISN.S'],
fields = ['TR.PE'],
parameters = {
'SDate': '2020-12-31',
'EDate': '-1D',
'Frq': 'D'
}
)
display(df)
I also get the P/E of the last 3 years, but I don't get any dates. I had this problem before and I was told that I just have to add .fperiod. But this does not work with TR.PE.
What do I have to do so that when I work with a start and end date, the date is always displayed.
Many thanks
Best Answer
-
Hi @michael.mauchle ,
I would advise using the get_history function. For more info on that function, please look into CodeBook's example:
__Examples__/01. Data Retrieval and Discovery/01.01. Refinitiv Data Library/Access__Get_History.ipynbrd.get_history(
universe=["LISN.S"],
fields=["TR.PE"],
interval="1D",
start="2020-12-31",
end="2023-12-31")0
Answers
-
Thank you - this is how it works
0 -
Hi, I'm having a similar problem, but when I try to get the data with the rd.get_history(), it's not work, as you can see below:
How can I pull this EPS data like in the rd.get_data(), but with the date column appears?
0 -
P.S.: I found a old tutorial with the ek.get_data where the get_data automatically create a 'Calc Date' column, available in https://github.com/LSEG-API-Samples/Article.EikonAPI.Python.WorkingWithFundamentalandEstimatesDCF/blob/main/Working%20with%20Fundamentals%20and%20Estimates%20Data%20-%20A%20DCF%20Example.ipynb
Does exists any similar way to do this with rd.get_data()?
Thanks!0 -
Hi @manuel.alvarez,
Please have a look at this tutorial page, where you can see how one can use the `get_data` function as you ask. In this instance, the Eikon and RD libraries work in very similar ways.
I would also suggest watching this DIB video, that relates to your inquiry.
In simple form, I think that wnat you are after is the parameters argument:
import refinitiv.data as rd
rd.open_session()
rd.get_data(
universe=["VOD.L"],
fields=["TR.RevenueMean(Period=FY1).calcdate",
"TR.RevenueMean(Period=FY1)"],
parameters={
# 'Curn': 'CAD',
# 'Frq': "1D"
'SDate': '-2000', # "2023-11-01",
'EDate': '0', # "2023-12-11",
})0 -
Hi! Thanks! That was exactly what I needed.
But, about the different outputs that are possible to get in fields parameters, like "date", "calcdate", "value", etc.
Where can I found some detailed explanation about each of these fields parameters?0 -
Hi @manuel.alvarez, The details you are after are in the DIB video
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 中文论坛