How to Normalize Historical Data for Splits, Dividends, Etc.

Note: Please read the disclaimer. The author is not providing professional investing advice.

If you’re using historical data to perform backtesting of trading algorithms it is important that your data be transformed from actual to effective historical prices. Otherwise your algorithm may, for example, interpret a 2:1 stock split as a 50% overnight drop.

Luckily if you’re using Yahoo! Finance as your source for historical data they provide an easy way to account for such issues. Yahoo has a short write-up about this, though in my opinion it falls a bit short. Therefore I’ll provide an example here.

The process of normalizing the data is simply to take the ratio between the stock’s “Adj. Close” to “Close” and apply it to all prices – that is the raw High, Low, Open, and Close.

For example, consider the following output from Yahoo’s historical database:

Table 1
Prices
DateOpenHighLowCloseVolumeAdj
Close*
4-Dec-0630.4031.1230.2430.841,455,90030.84
1-Dec-0630.3630.9430.0030.361,503,70030.36
1-Dec-063:2 Stock Split
30-Nov-0645.5145.5644.9645.471,155,80030.31
29-Nov-0645.7046.5445.6146.511,381,60031.01
29-Nov-06$0.09 Dividend
28-Nov-0646.5046.5145.5445.603,001,50030.31

If for each entry of each row (besides volume) we multiply by the ratio of that row’s Adjusted Close to Close, we get the effective historical prices:

Table 2
Prices
DateOpenHighLowCloseVolumeAdj
Close*
4-Dec-0630.4031.1230.2430.841,455,90030.84
1-Dec-0630.3630.9430.0030.361,503,70030.36
30-Nov-0630.3430.3729.9730.311,155,80030.31
29-Nov-0630.4731.0330.4131.011,381,60031.01
28-Nov-0630.9130.9230.2730.313,001,50030.31

For example, we compute the effective Open of the 30-Nov-06 row by multiplying the original value, 45.51, by 30.31 / 45.47 resulting in 30.34.