Back to Community
Dividend Bug Fixed in Pipeline Algorithms

Last week, we identified an issue with the dividend adjustments happening in the Pipeline API. We released a fix for it late last night.

The issue had to do with net vs. gross amounts being recognized as dividends, and the result was that only about 50% of dividends were being recognized by the pipeline API. Algorithms using the Pipeline API were using data that wasn't fully dividend adjusted during the pre-trading pipeline execution, though the dividends were being paid out correctly during the backtest itself. Going forward, algorithms using the Pipeline API will now reflect the correct dividends. Algorithms not using the Pipeline API were not affected.

For more information about how prices are split and dividend adjusted in the Pipeline API, please refer to this post.

In testing the fix for this issue, I created the attached algorithm. This uses the Pipeline API to show any dates where the pipeline is adjusting prices to account for a split or dividend. For any given symbol, it looks at the close price from two days ago and compares it to what the algorithm recorded as the close price for that same date yesterday. A price adjustment (split or dividend or both) will be reflected as a difference in these two historical prices.

In the image below, you'll see that I am recording a couple of different prices. T2_close is the close price 2 days before the current backtest date. Yesterday_t1_close is the price for that same day, as recorded yesterday. In this example, I am looking at AAPL in June of 2014 when they had a 7:1 stock split. You can see where the price changes as we look at it historically to reflect the adjustment. Feel free to clone the algo and tweak it to run for any security over any time period and see all of the adjustments.

I'm sharing this because it's an interesting, and easy way to see all the adjustment dates for any security. I expect the community can extend this in many ways, and will use it to help identify imperfections in our adjustment data. Please send any you find our way to be fixed.

Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5627bd1eb975d411033961a9
There was a runtime error.

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.

4 responses


I would like to audit the dividends for a specific security in a specific time frame, as an example 2010-01-01 through the present, writing out to log each dividend and date received for the security. This to make sure the total return adjustments in pipeline are correct.

I have specific concerns about symbol EDV in the time range between August 2014 and Jan 2015.

Also, I would like to visualize the total return data for a given security as a chart.

Would you mind posting the code that will do this for me? This would be greatly appreciated!

Hi John,
Just clone the algo above, and change the symbol from Apple to EDV. If you adjust your algo start and end dates to those you are interested in, you'll have exactly what you are looking for.

Can't wait to see what you find!

Thanks for the "dividend" algorithm.

The "t1 yesterday" less the t2 price approximates the dividend, and this ties out for my test symbol, EDV in 2014.

However, I still have a problem: there is an anomaly in August 2014 in the strategy I am developing that uses the symbol EDV. At all other times the systems match. This suggests that you may have a data or pipeline processing problem with EDV beginning in August 2014.

I ran a buy and hold strategy on EDV and the dividends received as cash match expectations, so the problem is probably pipeline processing, not underlying data. In fact, in the month of August pipeline sees a "nan" result for EDV (see below).

Would you mind taking a look at this under the hood to find out why the pipeline generates a "nan" result on August 4 2014 for EDV?

Thank you!

Log from Karen's Dividend Algo:

2014-08-04handle_data:60INFOadjustment on 2014-08-04 [Karen: Please note this odd 'adjustment.' Is it possible this is a data error?]
2014-08-04handle_data:62INFOyesterday's price (t1) = 106.81
2014-08-04handle_data:64INFOtwo days ago price (t2) = nan
2014-08-04handle_data:66INFOtwo days ago price from yesterday (t1 yesterday) = nan

Hi everyone,

Just wondering if there is now a built in function that allows us to get/detect stock splits. It looks like a pretty important feature.

Thanks in advance