Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Question on data.history API

Hi,

When I get the prices as below for today, 30 minutes after market opens:

prices = data.history(stocks, "price", 200, "1d").dropna(axis=1)  

Is the latest bar the close price today at 30 minutes after market open? or yesterday's close price?

Best regards,
Pravin

2 responses

See the help page, https://www.quantopian.com/help#ide-history . For example:

Examples (assuming context.assets exists):

data.history(context.assets, "price", 1, "1d") returns the current price.  
data.history(context.assets, "volume", 1, "1d") returns the volume since the current day's open, even if it is partial.  
data.history(context.assets, "price", 2, "1d") returns yesterday's close price and the current price.  
data.history(context.assets, "price", 6, "1d") returns the prices for the previous 5 days and the current price.

So, for the code you posted above, you should get 199 trailing daily closing prices, plus the current price (closing price of the prior minute) when you make the call to history.

Thanks Grant.