0
$\begingroup$

I am looking for a way to compute YTD return and I found this question (calculate YTD return / find first available datapoint of a year in python), however, it seems that it does not include the paid dividend in the year. How can I compute YTD return including the paid dividends?

My goal is to add this into my Python code for more accurate backtesting, so I would appreciate it if your answer considers Python implementation.

$\endgroup$
0
1
$\begingroup$

Assuming you aren't reinvesting the dividend in the stock, your YTD return would just be the price on date nplus the dividends received up to that date divided by the initial price:

ytd_return = (price_n + div_ytd) / price_0
$\endgroup$
1
  • $\begingroup$ thank you for your response. I guess that my question was not so clear and I edited it to be more accurate. I want this for more accurate backtesting, Do you know any python library that gives div_ytd? $\endgroup$ Oct 5 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.