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
(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.