Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 2

Total Return timeseries when a stock doesn't trade on a given day

Hello,

I'm working with Brazilian data, and I have trouble getting the right setup to get the correct time series of daily returns when a stock doesn't trade. For example, if you look at DHER34.SA between 2020-12-15 and 2020-12-23, it didn’t trade between Dec 17th and Dec 22nd.

If I try to grab the total return (TR.Totalreturn1d) on Dec 17th, 2020, it will give me the return on the last trading day rather than 0 since the stock didn’t trade on that day.


df, error = ek.get_data(instruments = ['DHER34.SA'],
                        fields=[{'TR.CLOSEPRICE(Adjusted=0)': {'Curn': 'BRL'}},
                               'TR.ClosePrice(Adjusted=0).CalcDate',
                               {'TR.CLOSEPRICE(Adjusted=1)': {'Curn': 'BRL'}},
                               'TR.ClosePrice(Adjusted=1).CalcDate',
                               {'TR.Totalreturn1d': {'Curn': 'BRL'}},
                               'TR.Totalreturn1d.CalcDate'],
                        parameters={'SDate': '2020-12-01', 'EDate': '2020-12-31', 'Frq': 'D', 'CH': 'Fd'}
)

In Excel, you can see the issue here:

=@TR("DHER34.SA","TR.TotalReturn.calcdate;TR.TotalReturn,TR.ClosePrice(Adjusted=1).calcdate,TR.ClosePrice(Adjusted=1)","SDate=2020-12-01 EDate=2020-12-30 Frq=D CH=Fd RH=IN")


Thank you in advance


#contentpython api
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.

1 Answer

· Write an Answer
Upvotes
Accepted
79.8k 257 52 75

@p.saffi

Thank you for reaching out to us.

I checked and found that the TR.ClosePrice field supports the Fill parameter with the None value. With this parameter, the values of the TR.ClosePrice field will be NA for non-trading days.

However, the TR.Totalreturn1d and TR.Totalreturn fields don't support this parameter. You can use the TR.Totalreturn1d.Date field to check the date of this value.

df, error = ek.get_data(instruments = ['DHER34.SA'],
                        fields=[{'TR.CLOSEPRICE(Adjusted=0)': {'Curn': 'BRL'}},
                               'TR.ClosePrice(Adjusted=0).CalcDate',
                               {'TR.CLOSEPRICE(Adjusted=1)': {'Curn': 'BRL'}},
                               'TR.ClosePrice(Adjusted=1).CalcDate',
                               {'TR.Totalreturn1d': {'Curn': 'BRL'}},
                               'TR.Totalreturn1d.CalcDate',
                               'TR.Totalreturn1d.Date'],
                        parameters={'SDate': '2020-12-01', 'EDate': '2020-12-31', 'Frq': 'D', 'CH': 'Fd','Fill':'None'}
)
df

1707979016399.png

You can also contact the Eikon support team directly via MyRefinitiv to verify this parameter and behavior.



1707979016399.png (64.4 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.