The pipeline API has some significant differences in how we are handling split and dividend price adjustments. Some questions have been asked about this, so I thought a detailed explanation in one place would be best.
In pipeline, the compute function uses pricing data that is split and dividend adjusted to the date for which the function is being called. (Go ahead and read that last sentence again. There's a lot of information to absorb there.)
Here is a simple dividend example. Company ABC puts out a $1 dividend quarterly with ex-dates of Jan 17, Apr 16, Jul 15, and Oct 15 in 2012. Company ABC is really boring and has the flattest stock price you've ever seen. It trades at 100 on the first day of the year and declines by a dollar on each ex-date as you'd expect, closing out the year at 96. In your algorithm, each morning before the market opens, your pipeline looks at a trailing window of data. You want to run a backtest over 2012. During the course of your backtest, the prices that the compute function uses look something like this:
Pipeline is using a different price adjustment method than we have used previously in Quantopian. The prices in the data object and in the history function continue to use the same adjustment method they always have. To refresh you on that behavior:
- In the data object, all splits are applied before the backtest starts, and the fully split-adjusted prices are used throughout the backtest. The data object doesn't have the concept of dividend adjustments at all. https://www.quantopian.com/help#overview-datasources
- The history function doesn't account for dividends at all, and reports a trailing window of fully split-adjusted prices.
- In backtests, you get dividends as cash payments. https://www.quantopian.com/help#ide-dividends
The fact that pipeline and the data object use different pricing adjustments is, unfortunately, confusing. We have an in-process project to change the data object to align with pipeline. The data object will become split and dividend adjusted to the date for which the object is being called. Until that project ships, we have these two different adjustment schemes in play.
A few other key points:
- Special dividends (where more than 25% of the value of the company is involved) are not handled by the backtester, not even as cash payments. However, special dividends are included in the pipeline calculation!
- Fundamentals data is not split or dividend adjusted.
- Data brought into research through the store is not split or dividend adjusted by Quantopian.
A final note about data accuracy: every time we extend our platform, it becomes a searchlight that exposes data errors that we hadn't seen before. Working with dividend-adjusted prices has been no different. We learned that a number of our dividends are in foreign currencies, and that results in some incorrect dividend adjustments. We are working on a solution. We expect that the community is going to find even more errors. The good news is that our data quality is always improving.