Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Dividend Adjustments

I have a question on how Quantopian treats dividends (below is your description for reference). The price adjustment of the dividend payment should be reflected on the opening of the ex-dividend date, and the ex date is 2 trading days prior to record date (not 3 as claimed below).

The dividend becomes a 'receivable' that should tracked by the strategy and included in performance figures. I noticed that it was not when tracking the performance differential between SPY and the S&P 500. The strategy first 'loses' money on the ex-div date and then has a small windfall gain on the payment date. It nets out except for when the dividend has yet to be paid.

Also, system developers need to know the amount of the dividend in order to properly adjust their indicators. A large price drop could otherwise create false signals.

A good example of a large 'normal' dividend is the $5 special dividend paid by Anixter International (NYSE:AXE) with a Record Date of Dec-11-2013 and an Ex Date of Dec-9. The stock closed at $92.36 on Dec-6 (Record Date - 3 BDs) and opened the following trading day (Monday Dec. 9) at $87.53.
AXE Prices on Yahoo Finance

Per NASDAQ Rules

(b) Normal Ex-Dividend, Ex-Warrants Dates

(1) In respect to cash dividends or distributions, or stock dividends, and the issuance or distribution of warrants, which are less than 25% of the value of the subject security, if the definitive information is received sufficiently in advance of the record date, the date designated as the "ex-dividend date" shall be the second business day preceding the record date if the record date falls on a business day, or the third business day preceding the record date if the record date falls on a day designated by Nasdaq Regulation as a non-delivery date.

(2) In respect to cash dividends or distributions, stock dividends and/or splits, and the distribution of warrants, which are 25% or greater of the value of the subject security, the ex-dividend date shall be the first business day following the payable date.

(3) In respect to stock dividends and/or splits relating to American Depository Receipts (ADRs) and foreign securities, the ex-dividend or ex-warrants date shall be designated by Nasdaq Regulation.

Per Wikipedia:
In the United States, the Securities and Exchange Commission stipulates that there are three days of settlement for stock trades.[3] The ex-dividend date is normally two business days (3 minus 1) before the record date. For the purpose of calculating an ex-dividend date, business days are days on which both the major stock exchanges and the banks in New York State are open.[4] Thus Columbus Day and Veterans Day are trading days, but not business days for calculating an ex-dividend date, since they are legal holidays and banks are not open.
If the record date is not a business day, then counting begins from the most recent business day instead of the actual record date.[5] For instance, if the record date is Sunday, then the ex-dividend date is the preceding Wednesday, not Thursday — assuming no intervening holidays.
The ex-dividend date is two business days prior to the record date. To be a stockholder on the record date an investor must purchase the stock before the ex-dividend date. The latest date he can buy the stock to be a stockholder on record and be entitled to the dividend would be one day prior to the ex-dividend date (this includes extended hours (pre-market and after-hours) of that day) to allow for the three stock trading day settlement of the stock purchase. If the investor purchases the stock the day before the ex-dividend date the investor would be a stockholder on the record date and would be entitled to receive the dividend payment.[6]

==================================

QUANTOPTIAN DIVIDEND DESCRIPTION

Dividends

The Quantopian database holds over 150,000 dividend events dating from January 2002. While other corporate events, such as splits and mergers, are handled by adjusting historical prices and volumes, dividends are more complex. Dividends are treated as events and streamed through the performance tracking system that monitors your algorithm during a backtest. Dividend events modify the security price and the portfolio's cash balance.

Dividends specify four dates:

declared date is the date on which the company announced that the dividend.
record date is the date on which a shareholder must be recorded as an owner to receive a dividend payment. Because settlement can take 3 days, a second date is used to calculate ownership on the record date.
ex date is 3 trading days prior to the record date. If a holder sells their stock before this date, they are not paid the dividend. The ex date is when the price of the stock is typically most affected.
pay date is the date on which a shareholder receives the cash for a dividend.
Stock prices are marked down by the dividend amount on the open following the ex_date. The portfolio's cash position is increased by the amount of the dividend on the pay date. Quantopian chose this method so that cash positions are correctly maintained, which is particularly important when an algorithm is used for live trading. The downside to this method is that this can create a noticeable discontinuity in price history and a short portfolio value.

In order for your algorithm to receive dividend cash payments, you must have a long position (positive amount) in the stock as of the close of market on the trading day prior to the ex_date AND you must run the simulation through the pay date, which is typically about 60 calendar days later.

If you are short the stock at market close on the trading day prior to the ex_date, your algorithm will be required to pay the dividends due. As with long positions, the cash balance will be debited by the dividend payments on the pay date. This is to reflect the short seller's obligation to pay dividends to the entity that loaned the stock.

8 responses

Hello Colin,

I think that you're right. There are two significant improvements to our dividend system in there.

  1. Track a "receivable" counter so that your algo can know that the cash is expected, at least for the purposes of smoothing the returns
  2. Pass dividends as events into handle_data() so that people can code around them.

The second one was been requested a couple times, but the first is new to me. I like it though.

I'm not sure when we'll next revise the dividend code, but I agree with your suggestions.

Dan

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.

I'm just curious if the second feature has been applied yet? I certainly know it would be very helpful to have that information.

Hi Trevor,

The dividend code hasn't been revised yet. Currently, dividends are added as cash to your portfolio and are not automatically reinvested.

However, the benchmark, whose default is SPY and is customizable, will reinvest the dividends during the backtest.

Cheers,
Alisa

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.

How does one determine the ex-dividend date?

The ex-date is 3 days prior to the record date, which is when a shareholder must be recorded as an owner to receive a dividend payment.

Are you looking for an API call in the IDE to return the dividend data? If so, we don't yet have this functionality, but I think that's a great idea.

Yea, after posting here, I found a thread where someone was scraping dividend information from yahoo; I'm currently using that, but it would be AWESOME if dividend, ex-dividend date, dividend date, and dividend pay date were available in the base product. I need to add some logic in there to see if the 3 days prior isn't a weekend and then back up to a valid day the market is open to execute an order. Although coordinating the pay date with the fact that you were eligible for the dividend might be a bit quirky.

thanks,

"Currently, dividends are added as cash to your portfolio and are not automatically reinvested." - Are you sure? I tried a very simple strategy (holding DIA from 01/01/2007 to 12/31/2007) and received only one dividend (2007-10-15). So, where are the others? http://finance.yahoo.com/q/hp?s=DIA&a=00&b=1&c=2007&d=11&e=31&f=2007&g=v

Hi Petr, it looks like there may be a dividend discrepancy for DIA in our database. I wrote a simple algo and saw the unexpected behavior you described. Thanks for pointing that out and we'll get that fixed.