Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Questions about closing price

Hi,

i wanted to look at some of the pricing data from the last couple of weeks

in a notebook cell i put

spy_filter = StaticAssets([spy])  
get_pricing(spy, start_date='2-5-2018', end_date='2-17-2018', fields='close_price') 

giving

2018-02-05 00:00:00+00:00 264.18
2018-02-06 00:00:00+00:00 269.19
2018-02-07 00:00:00+00:00 267.65
2018-02-08 00:00:00+00:00 257.72
2018-02-09 00:00:00+00:00 261.69
2018-02-12 00:00:00+00:00 265.28
2018-02-13 00:00:00+00:00 266.02
2018-02-14 00:00:00+00:00 269.70
2018-02-15 00:00:00+00:00 273.01
2018-02-16 00:00:00+00:00 273.09
Freq: C, Name: Equity(8554 [SPY]), dtype: float64

and in another cell i put

spy = symbols('SPY')  
spy_filter = StaticAssets([spy])  
x_pipeline = Pipeline(  
        screen = spy_filter,

        columns = {  
            'close' : USEquityPricing.close.latest,  
        }  
    )  
results = run_pipeline(simple_beta_pipeline, '2-5-2018', '2-17-2018')  
results  

giving
close
2018-02-05 00:00:00+00:00 Equity(8554 [SPY]) 275.51
2018-02-06 00:00:00+00:00 Equity(8554 [SPY]) 264.18
2018-02-07 00:00:00+00:00 Equity(8554 [SPY]) 269.19
2018-02-08 00:00:00+00:00 Equity(8554 [SPY]) 267.65
2018-02-09 00:00:00+00:00 Equity(8554 [SPY]) 257.72
2018-02-12 00:00:00+00:00 Equity(8554 [SPY]) 261.69
2018-02-13 00:00:00+00:00 Equity(8554 [SPY]) 265.28
2018-02-14 00:00:00+00:00 Equity(8554 [SPY]) 266.02
2018-02-15 00:00:00+00:00 Equity(8554 [SPY]) 269.70
2018-02-16 00:00:00+00:00 Equity(8554 [SPY]) 273.01
2018-02-20 00:00:00+00:00 Equity(8554 [SPY]) 273.09

interestingly

the output values in the pipeline are all out by one day compared to get_pricing and have a last date of 20th Feb. Also the last entry of 273.09 is different than the value i have seen on different sites including yahoo finance (link is https://finance.yahoo.com/quote/SPY/history?p=SPY)

So my questions are :
1. what is going on ?
2. why is the last close price for SPY different in Quantopian than that published elsewhere ?

thanks for any help.

Regards,

1 response

Two VERY common (and good) questions.

First, "the output values in the pipeline are all out by one day compared to get_pricing... what is going on ?" True, the values returned by pipeline appear 'offset' by one trading day. The issue is a matter of semantics. The 'get_pricing' method gets prices as of the requested dates (or times). The 'run_pipeline' method runs the pipeline as of the requested dates. The pipeline output always returns data as of the previous day. So, if it is run today, it will return data as of yesterdays close. In an algorithm, the pipeline data is typically run in the 'before_trading_start' to get the latest prices (ie the previous days close). So, in 'get_pricing' the date is the price dates. In 'run_pipeline' the date is the date to run the pipeline.

Second, why is the last close price for SPY different in Quantopian than that published elsewhere ?. See the Q FAQs (https://www.quantopian.com/faq) "Why is your close price different from other data sources?"

There are a number of posts here in the forums addressing similar data questions. Here are a couple
https://www.quantopian.com/posts/data-for-us-equity-pricing
https://www.quantopian.com/posts/pricing-differences

Hope that helps.