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