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

Tagged:

Best Answer

  • [Deleted User]
    [Deleted User] Newcomer
    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.ipynb

    rd.get_history(
    universe=["LISN.S"],
    fields=["TR.PE"],
    interval="1D",
    start="2020-12-31",
    end="2023-12-31")


    1701712427262.png

Answers