Hi everyone!
I want to compare some strategies based on dividend income. I know dividends are added to portfolio cash on the payout date and I wonder if someone can recommend (or share) some code that records dividends?
Thanks!
Hi everyone!
I want to compare some strategies based on dividend income. I know dividends are added to portfolio cash on the payout date and I wonder if someone can recommend (or share) some code that records dividends?
Thanks!
Hi all,
Here are the two solutions I came up with. One attempts to count the cash that is accumulating. The other attempts to track based on the dividends per share metric. They produce significantly different results, but I do understand why. The cash accumulating method is probably more accurate, and it's definitely easier. It also shows "bigger" results, which is the only "downside". (I prefer to underestimate vs overestimate).
In the end, my use case is to compare strategies using the "dividend returns" metric and i'll be calculating it the same way for all strategies so, it will be an apples to apples comparison.
Ill attach. both algos here. I'd be interested to see what people think, and if anyone has some helpful ideas or better methods.
Thanks,
Brett