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

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
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