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.