Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Different data between get_pricing in notebook and data.history in algo

Hi all, very new to algorithmic trading/python/etc., so go easy on me :)

Basically I'm trying to make data from my algo match what I'm seeing in my notebook, if possible.

For example, in my notebook, I'm retrieving intraday prices using:

prices = get_pricing(symbol, fields='price', start_date=END_DATE, end_date=END_DATE, frequency='minute').dropna()  

In my algo I'm using:

price = data.history(security, fields="price", bar_count=1440, frequency='1m')  

But I'm getting different results. I've read a few forum threads about similar issues, but I couldn't find a solution to my problem.

3 responses

Hmm. Maybe I've misunderstood your question?

I used the lines of code you had for a notebook and then for an algorithm. I got identical data returned for each. Attached is a notebook which gives the prices returned by the 'get_pricing' method. I'll post an algorithm next which get's the same data using the 'data.history' method. At least for AAPL on 2017-12-19 the prices match perfectly. I didn't look at a lot of other dates or securities, but they seem to match in this small sample?

Perhaps give an example of where a difference is seen.

Here is an algorithm using the 'data.history' method to get the same data. Check the logs which print the last 20 prices.

Hi Dan, Yeah I think I had brain fart with that. I was comparing results from a linear regression (forgot to explain that) on static price data from get_pricing and rolling price data from data.history, expecting the same results. At least I think that was the problem. Thanks for your help!