Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Proposed Feature Change: Dividend-Adjusted Prices

This proposal is obsolete.

Please see the updated proposal here: https://www.quantopian.com/posts/version-2-proposal-for-dividend-adjusted-prices

Old Proposal

We've had a lot of feedback about how our implementation of dividends could go farther. It's not that the current implementation is wrong - it's quite good for backtesting fidelity purposes - but it doesn't provide enough information for algo writers to implement their strategies. We're about to kick off a development cycle to add to our dividend feature set, and we're looking for feedback.

Proposed Change
We're going to add a new property in the data object, exact name tbd, that looks like this:

data[stock].dividend_adjusted_price  

That means that at any given point in your algorithm you'll have access to both the stock split-adjusted price (what we're all used to on Quantopian today) and a new property, the split-and-dividend-adjusted price. That change would open up a number of use cases that have been requested.

  • The way that the Quantopian backtester handles dividends is unaffected. You still get dividends as cash payments. It's probably worth a minute of your time to review the current implementation:
  • With the change, your portfolio value is unaffected - still the same split-adjusted price times the same volume.
  • Even with the change, your portfolio overall returns will still have a "jag" during dividends. That's because your portfolio loses value on the ex-date when the price of the stock drops, and the portfolio recovers a few days later when the actual cash is delivered.
  • The dividend_adjusted_price is there as a signal for you to use and calculate moving averages and returns and such; the dividend_adjusted_price doesn't represent the actual value of the stock at that time.

How it's calculated
Quantopian already provides split-adjusted prices. Our documentation describes it this way: "Our data uses adjusted close prices. That means that the effect of all stock splits and merger activity are applied to price and volume data. As an example: A stock is trading at $100, and has a 2:1 split. The new price is $50, and all past price data is retroactively updated 2:1 (volume data is correspondingly updated 1:2)."

In the same way, we will apply a dividend multiplier. When there is a dividend, all past price data will be updated by the dividend multiplier. (Yahoo's adjusted price is computed by the same process.

dividend_multiplier = 1 - (dividend_amount/close_price_pre_ex_date) = 0.nnnnn  

Use cases

  • You want to know the long-term economic return for a given security
price_history = history(bar_count=252, frequency='1d', field='dividend_adjusted_price')  
returns = price_history.iloc[[0, -1]].pct_change()  
  • You want to track the moving average, or perform any other calculations on a look-back window
price_history = history(bar_count=252, frequency='1d', field='dividend_adjusted_price')  
returns = price_history.mean  
  • You want to open or close a position (long or short) based on the upcoming dividend, or study price behavior around dividend surprises
    • Unfortunately, this is not supported still.
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.

5 responses

Outstanding! I just finished a crude hack to get multiple symbol adjusted close prices via yahoo finance and fetcher. This will be a very welcomed addition - thanks!

+1 for this. Glad to see you've been listening to your community.
Which branch should be tracked on Zipline to follow the course of this dev ?

Just to be clear, according to Yahoo's page that you linked, they calculate the dividend multiplier using the closing price of the day before the ex-dividend date, not the closing price of the ex-dividend date.

Thanks Simon, that's a good catch. I edited it both here and in our dev process.

This proposal is obsolete. I just posted a revised proposal.