Page 1 of 1
Calculating daily dividend yield
Posted: Mon Dec 21, 2020 8:38 am
by msrahman
Hello,
I want to calculated the daily dividend yield in the following way:
The dividend yield in day t is computed by summing the daily dividends for the week preceding day t and dividing by the value of the portfolio at t.
I have attached the xls file here. Any help would be appreciated.
Sincerely,
Sajjadur.
Re: Calculating daily dividend yield
Posted: Mon Dec 21, 2020 2:45 pm
by TomDoan
You need to be a bit more precise about what you want. What happens when you have a week with fewer than five days? Also, are you looking at a value for each day, or just one per calendar week?
Re: Calculating daily dividend yield
Posted: Tue Dec 22, 2020 8:53 am
by msrahman
Thanks for your reply.
If there is a week fewer than five days, I would like to drop that week.
I am looking for the value for each day.
Sincerely,
Sajjadur.
Re: Calculating daily dividend yield
Posted: Tue Dec 22, 2020 10:51 am
by TomDoan
This sounds like it will do what you want. Note that this will have quite a few five day gaps in the output series since any missing date in dividends will knock out five days of the weekly average.
OPEN DATA "C:\temp\Dividend_Rats.xls"
CALENDAR(D) 2007:1:3
DATA(FORMAT=XLS,ORG=COLUMNS) 2007:01:03 2019:12:31 VALUE<<"Value of the Portfolio" Dividend
FILTER(TYPE=LAGGING,WIDTH=5) DIVIDEND / WEEKLYAVG
set yield = 5*weeklyavg/value