Back to Community
Why the historical datas for XIV in May 2011 are so different between those from Algorithm and Notebook?

Occasionally by backtesting I found this stranger thing. See attached algo and notebook.

Here are what I get from algo:
... 2011-05-02 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 174.92
2011-05-03 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 169.85
2011-05-04 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 166.25
2011-05-05 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 164.19
2011-05-06 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 159.42
2011-05-09 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 163.25
2011-05-10 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 168.71
2011-05-11 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 174.25
2011-05-12 14:45 before_trading_start:48 INFO Original DF:
close
Equity(40516 [XIV]) 171.0
...

Clone Algorithm
0
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 597076407d48175230af712a
There was a runtime error.
3 responses

Here is the attached notebook.

Loading notebook preview...
Notebook previews are currently unavailable.

By running the algo and notebook one can see in May 2011 the XIV prices in the range of 170. But those fro mthe notebook in the range of 17. The difference is 10x.

I guess this must be something wrong in Q's database.

The prices do differ by 10x because on June 27, 2011 there was a 10 for 1 stock split. The price of each share was reduced by 1/10 while the number of shares increased by 10x. See http://www.splithistory.com/?symbol=xiv .

The algorithm prices being printed are the actual prices as of that day of the backtest (ie the current day prices are not adjusted for any future splits). However the notebook prices using the 'get_pricing' method are split adjusted as of the end_date of the query.

Maybe take a look at this post https://www.quantopian.com/posts/help-notebook-vs-algorithm . See Jamie McCorriston's Jun 5, 2017 post towards the end for a good explanation of how 'get_pricing' and pipeline differ in handling splits.