Adjusted Prices Without Look-Ahead Bias
When backtesting an investment strategy, that is, when simulating an investment strategy using historical prices to test how this strategy would have behaved in the past, historical prices are most of the time adjusted for dividends, splits and other events with price impact1.
Unfortunately, and while little known, the standard way of computing adjusted historical prices is a source of look-ahead bias!
In this short blog post, I will illustrate the problem - as well as a possible solution - with the SPY ETF.
Notes:
- A Google Sheet corresponding to this post is available here
The source of look-ahead bias in adjusted prices computation
The industry standards related to the computation of adjusted prices have been established by the Center for Research in Security Prices (CRSP).
In particular, the CRSP states that an adjustment base date must be chosen to compute adjusted prices and somewhat encourages this base date to be chosen as the last date for which raw prices are available2:
An adjustment base date is chosen as the anchor date. All data on this date are unadjusted, and other data are converted based on the […] events between the base date and the time of that data. The adjustment base date is usually chosen to be the last available day of trading.
As a consequence, the stock market data providers that follow the CRSP guidelines usually implement this way of computing adjusted prices, which is called backward prices adjustment.
Problem is, backward prices adjustment introduces a look-ahead bias because the backward-adjusted price on any given past date depends on all future events with price impact between this date and the last date for which raw prices are available.
As an example, below are the adjusted close prices of the SPY ETF over the period 04th January 2021 - 31th December 2021, retrieved from Tiingo on both 04th May 2022 and 18th June 2022:
Date | Close Prices | Adjusted Close Prices (retrieved on 04th May 2022) | Adjusted Close Prices (retrieved on 18th June 2022) |
---|---|---|---|
2021-01-04 | 368.79 | 362.7802300392 | 361.2233432125 |
… | … | … | … |
2021-12-31 | 474.96 | 473.5049204022 | 471.4728538453 |
It is clearly visible that the adjusted close prices retrieved on 04th May 2022 and on 18th June 2022 differ over the whole period.
And indeed, because a dividend distribution of $1.576871 took place on 17th June 2022:
- The backward-adjusted close price of the SPY ETF on 04th January 2021 retrieved from Tiingo on 18th June 2022 - which depends on dividend distributions between 04th January 2021 and 18th June 2022 - must be different from the backward-adjusted close price of the SPY ETF on 04th January 2021 retrieved from Tiingo on 04th May 2022 - which depends only on dividend distributions between 04th January 2021 and 04th May 2022
- …
- The backward-adjusted close price of the SPY ETF on 31th December 2021 retrieved from Tiingo on 18th June 2022 - which depends on dividend distributions between 31th December 2021 and 18th June 2022 - must be different from the backward-adjusted close price of the SPY ETF on 31th December 2021 retrieved from Tiingo on 04th May 2022 - which depends only on dividend distributions between 31th December 2021 and 04th May 2022
Computing adjusted prices without look-ahead bias
Whether one considers this look-ahead bias to be a real issue or not, it is possible to avoid it altogether by choosing the adjustment base date as the first date for which raw prices are available instead of the last date for which raw prices are available.
This alternative way of computing adjusted prices is called forward prices adjustment and is discussed for example:
- In the book Quantitative Portfolio Management: The Art and Science of Statistical Arbitrage from Michael Isichenko
- On StackExchange
- On the QuantDare blog post Approach to dividend adjustment factor calculation by Jesus Gonzalez
As a side note, Portfolio Optimizer implements the computation of forward-adjusted open/high/low/close prices thanks to the endpoint /assets/prices/adjusted/forward
.
Figure 1 illustrates the differences between backward-adjusted and forward-adjusted close prices for the SPY ETF over the period 04th January 1999 - 17th June 2022:
As expected:
- The backward-adjusted close price is equal to the raw close price on 17th June 2022 and both prices are different for all the other dates
- The forward-adjusted close price is equal to the raw close price from 04th January 1999 to 18th March 1999 and both prices are different for all the other dates3
Happy (forward) price adjustments!
–
-
Spin-offs, etc. ↩
-
See the website of the Center for Research in Security Prices. ↩
-
19th March 1999 is the date of the first dividend distribution for the SPY ETF over the period 04th January 1999 - 17th June 2022 ↩