Ho to get daily total returns

Hello everyone

I am trying to get the daily total return for a stock. The code I am using is:

import refinitiv.data as rd
rd.open_session()
df = rd.get_data(
universe = ['NESN.S'],
fields = ['TR.DAILYTOTALRETURN'],
parameters = {
'SDate': '2023-12-31',
'EDate': '-1D',
'Frq': 'D',
'Curn': 'CHF'
}
)

display(df)

This should be correct in my opinion, but I don't get any data.

Outpout:

1713511026194.png

What am I doing wrong.

Thank you very much

Tagged:

Best Answer

  • Jirapongse
    Answer ✓

    @michael.mauchle

    Thank you for reaching out to us.

    It should be TR.TotalReturn, as shown below.

    import refinitiv.data as rd
    rd.open_session()
    df = rd.get_data(
        universe = ['NESN.S'],
        fields = ['TR.TOTALRETURN'],
        parameters = {
            'SDate': '2023-12-31',
            'EDate': '-1D',
            'Frq': 'D',
            'Curn': 'CHF'
        }
    )
     
    display(df)

    You can use the Data Item Browser tool to list all avaialble fields and parameters.

Answers

  • Many thanks for the super quick reply :)

    Will I then receive the daily returns?

    How can I add the date?

    What I find strange is that if I take the data from the beginning of the year, I get a cumulative performance of -4.2559%. But if I look at the total return in Workspace itself, I get -4.38%.

  • I have recognized the problem. I had -1 at End Date, as I thought this would take until yesterday. But I have to take End Date = 0


    But how can you add the date?

  • @michael.mauchle

    You can add the TR.TOTALRETURN.Date field.

    import refinitiv.data as rd
    rd.open_session()
    df = rd.get_data(
        universe = ['NESN.S'],
        fields = ['TR.TOTALRETURN','TR.TOTALRETURN.Date'],
        parameters = {
            'SDate': '2023-12-31',
            'EDate': '-1D',
            'Frq': 'D',
            'Curn': 'CHF'
        }
    )
     
    display(df)

    1713515705352.png