Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
total return / dividends

does quantopian account for dividends?

13 responses

Right now, no, but I literally just finished the code to account for dividends. It should be live within a few days.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

that sounds great. will it be "automatic" or is it some sort of a choice that needs to be flagged?
will it handle short sale dividend issues, too?

which brings up another question: do you deal with hard to borrow situations?

Dividends will be automatically incorporated into the algorithm returns. We check your holdings on the ex_date, and increment your cash position on the pay_date.

Short positions currently have no impact - dividends are simply ignored and have no impact on the returns. I have to admit, I just wasn't sure what the correct handling should be, so I would appreciate feedback.

The system is margin and borrow naive, meaning, we don't limit your leverage, we don't incur any interest charges for shorting, and we don't do anything special for filling a long vs. a short. To do this properly requires historical data for borrowing rates and availability, which we have not added to the platform.

thanks,
fawce

i agree, the borrow is probably too tough to be next on your list for some time. i'd argue you are better off adding futures -- no divs, no takeovers, no corp actions, no survivor bias and a lot of new types of assets. on the other hand there are all sorts of issues due to the dates (maybe spot f/x easier). anyway ...

short positions have to pay the dividend. if you think about it, you borrow the stock from A and sell it to B. B has the shares (you've sold them to B) and gets the dividend. A lent you the shares, but owns the stock. who pays A the div? you do.

now with dividends, there might be withholding issues due to taxes, particularly for ADRs. but i'd ignore that only because different entities are going to have different withholding constraints. i'd keep it naive and document it.

my .02.

Thanks for the explanation about short positions and dividends. Are dividend payments on the short position subject to the same dates for ex and payment?

Yes, same dates and everything, it's just a mirror image.

Thanks for the help guys. I'm fixing up the implementation in Zipline now.

you can think of it as if you issued new shares of the company -- only since they were issued by you, it is you that has to provide the dividend.

I find it really surprising that two parties get the dividend payment in the case of a short, but I can see that the lender of the stock would expect to be paid.

Fortunately, your explanation made the implementation very clear, so I just submitted a pull request to the zipline repo with the fix to the code and the short position returns test: https://github.com/quantopian/zipline/pull/76

I would expect us to push this to Quantopian in a day or two.

thanks for all the help!

to address your surprise, try to think about the new shares being issued by the short (because they are). the company pays the dividend for the shares that it has issued and is clearly not responsible for those that is has not. the short seller is, in a very real sense, issuing new shares. this is limited by the ability to borrow shares from the outstanding float. when one buys the shares, one has no idea if it is from a long or short seller but still is entitled to all of the rights associated to those shares. this can be as simple as delivering the electronic certificates or require a short seller to pay the dividend out of their own pocket or cause real headaches in the case of corporate actions that require the shares be exchanged or changed in some way (think of rights offerings or takeovers). hope that helps.

Hi,

Dividends are now properly accounted in the performance and returns, including for short positions! The attached backtest is for the Utility Holders ETF, which has an inordinate number of dividend payments (as many as 50+ per year). Next we're working on getting the dividend information into the algorithm API.

Thanks again for all the input,
fawce

Cool -- but I just replicated your algo and changed to COST (costco), which had a $7 dividend in December, and I'm not convinced it was taken into account?

Simon, thanks for this. Looks like the special dividend is missing from our DB. I'm tracking it down. We also discovered a timezone bug on the dividend dates as a result of digging into this. I'll post back when we have both issues sorted out.