quantopian/zipline — pull request #367 by ssanderson (2014-07-07 18:44:49+00:00)
Title: BUG: Fix an issue where dividends are granted a day early.

Fixes an issue where `PerformancePeriod.update_dividends` was being called with
incorrect dates in `handle_minute_close` and `handle_market_close`, which
resulted in dividends being granted a day early. This is primarily a problem
because it causes algorithms to incorrectly receive dividends when the stock in
question is purchased on a dividend's ex_date. After this change, dividends
are granted only when the algorithm held stock on the market close of the day
before the dividend's ex_date. This is in line with the following quote from
the SEC's notes on dividend ex_dates:

> If you purchase a stock on its ex-dividend date or after, you will not
> receive the next dividend payment. Instead, the seller gets the dividend. If
> you purchase before the ex-dividend date, you get the dividend.