Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Data for US Equity Pricing

Hi there,

is the latest close price for USEquityPricing.close.latest actually the latest from the last day?
Is it also possible to get the latest from the current day?
I am using the following code:

def make_pipeline():

    closeprice = USEquityPricing.close.latest  
    ret = DailyReturns()  
    filters=StaticSids([24])

    return Pipeline(  
        columns={  
            'latest_close' : closeprice,  
            'return' : ret  
        }, screen=filters  
    )  
mpipe = make_pipeline()

The output is:

latest_close return
2018-02-01 00:00:00+00:00 Equity(24 [AAPL]) 167.47 0.002934
2018-02-02 00:00:00+00:00 Equity(24 [AAPL]) 167.70 0.001373
2018-02-05 00:00:00+00:00 Equity(24 [AAPL]) 160.41 -0.043470
2018-02-06 00:00:00+00:00 Equity(24 [AAPL]) 156.49 -0.024437
2018-02-07 00:00:00+00:00 Equity(24 [AAPL]) 163.06 0.041984
2018-02-08 00:00:00+00:00 Equity(24 [AAPL]) 159.52 -0.021710
2018-02-09 00:00:00+00:00 Equity(24 [AAPL]) 154.53 -0.027332
2018-02-12 00:00:00+00:00 Equity(24 [AAPL]) 156.23 0.011001
2018-02-13 00:00:00+00:00 Equity(24 [AAPL]) 162.76 0.041797

Looking at Yahoo the close price of 156.23 on 2018-02-12 was more likely the close price from 2018-02-09.

How to I really get the latest price?

Thanks for your help!

1 response

Pipeline always returns data as of the close of the previous day. So, yes, if one calls 'pipeline_output' on 2018-02-12 (a Monday) then one would get the data as of the close on 2018-02-12 (the previous Friday). Pipeline also only returns daily data (ie the days high or low or close). To get the current days price and volume use the 'data.history' or the 'data.current' methods (see https://www.quantopian.com/help#api-data-current and https://www.quantopian.com/help#api-data-history ). This can be fetched as either daily or minutely data. Something like this.

my_stocks = symbols('AAPL', 'IBM')  
last_minute_close_prices = data.current(my_stocks, 'price')

This will return a pandas Series with the index being the assets (ie 'my_stocks') and whose values are scalar values for the price. Hope that helps.