question

Upvotes
Accepted
22 1 0 5

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

codebook
1713511026194.png (2.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
79.4k 253 52 74

@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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
22 1 0 5

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%.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
22 1 0 5

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?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
79.4k 253 52 74

@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


1713515705352.png (10.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.