Inconsistent AAPL data between prices() and data comming from the pipeline.

Hi, i'm getting different data results when getting the close price from prices() when compared to getting the data from the pipeline, what am i doing wrong?

0
Notebook previews are currently unavailable.
5 responses

Is no one concerned about the inconsistency of data on one of the most traded stocks?

Prices and volumes are backwards split adjusted when using the get_pricing and prices methods. When fetching data via pipeline the data is exactly what would have been seen on that day (ie not split adjusted). Take a look at this post https://www.quantopian.com/posts/usequitypricing-and-get-pricing-data-difference for maybe a better explanation.

Hope that helps.

Ok thanks Dan! will my backtests take into consideration the split? for example after the AAPL 7:1 will i have 7 times the stock in the backtest?

Yes, the Zipline backtesting engine will adjust the quantity of shares as well as the cost basis for those shares as of the date of any splits. In the case of AAPL one would have 7x the shares with a cost basis of 1/7 of what it would have been before the split. Write a small program that buys 100 shares of AAPL before June 9, 2014 then look at the daily positions in the backtest results. After June 7 one would have 700 shares.

This is one reason to never store any price or volume data in a backtest. It's always best to fetch new data each day to ensure the data is always split adjusted.

BTW, dividends are also accounted for and added to one's portfolio as cash on the pay date if the stock was held on the ex date.

Thanks Dan really appreciate it!