Quantopian 1
Quantopian 2

Split adjustments were applied to all prices and volumes before the algorithm even started.

This adjustment caused slippage and commissions to sometimes be slightly inaccurate, and also permitted some look-ahead bias to leak into the simulation. It also resulted in backtest results not being reproducible over time, because a simulation tomorrow might use different adjustments than a simulation run today.

Simulation uses as-traded prices.

The algorithm gets all prices in the as-traded form during simulation. When orders are placed, the fill price, slippage, and commissions are calculated using the as-traded price. Slippage and commissions are now applied correctly, without distortion. Backtests are now reproducible over time.

Lookback windows (like history()) used split-adjusted prices only - dividends were not applied.

This solved the most basic problem: your lookback windows were adjusted for splits, and comparisons over time made sense in the general case. However, missing dividend information in the lookback window made it very difficult to calculate returns of a given security.

Lookback windows now use prices that are split-, merger-, and dividend-adjusted.

You can now make accurate calculations of the returns of securities because the price information in the lookback window is fully adjusted. When your algorithm calls for historical data using history() or in pipeline calculations, the data is returned to the algorithm with prices adjusted to the date of simulation.

How do price
adjustments work?

Price adjustments depend on three elements: the date of the price, the date that the price is being considered from, and any events (splits, dividends, and mergers) that happened between those two dates.

In 2014, AAPL had a 7:1 stock split. We are going to use this as an example to illustrate price adjustments.

AAPL in May 2014

What was AAPL’s price on May 15th, 2014, from the perspective of May 15th, 2014? This is easy - $588.82. There are no events between the two dates, so we just need the as-traded price.

AAPL in July 2014

What was AAPL’s price in July 1, 2014, from the perspective of July 1, 2014? This is easy - $93.52. There are no events between the two dates, so we just need the as-traded price.

AAPL's price change
from
July 1 to
August 1, 2014

On August 1st the as-traded price was $96.13. There are no events between July 1 and August 1, so we can use the as-traded prices. The price increased 2.7%.

AAPL's price change
from
May 15 to
August 1, 2014

In this case, there is an event (a 7:1 stock split) between the two days. If you simply look at the raw price numbers from May 15, 2014 to August 1, 2014, you are going to get a price change of of -84%. That calculation isn't very useful. It is not reflecting a change in the underlying real value of AAPL, which is the useful information we are seeking. This calculation doesn't take into account the 7:1 stock split.

AAPL's adjusted price from
May 15 to August 1, 2014

To make that calculation useful, we first adjust the historical prices in our lookback windows. The price adjustment allows us to compare prices across splits and dividends. The adjusted price for May 15 is ($588.82/7), or $84.12. That enables us to calculate the percent change in AAPL from May 15, 2014 to August 1, 2014 to be 14.3%.

Get Started on Quantopian