Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to get opening price info before the bell

Does Quantopian have a way to reference what the opening price of a security is before the trading day begins?

6 responses

Hello Michael,

Do you mean the prior day's close, or the price right at the open of the day? Both are available.

Grant

I'm looking for the price at opening. I know i can call the history function at the beginning of trading, but I would think this would give me the price at minute 1, rather than allowing me to know what the opening price is before trading commences. I suppose there might be a way to use futures data for getting in the ballpark for major indexes, but otherwise, I don't know how to access this data

Note that you can retrieve the open price for the prior minute (see https://www.quantopian.com/help#ide-history). So, at 9:31, you can get the price of the first trade of the day (in addition to the HLCV values of the OHLCV minutely bar). Is this what you need? --Grant

Is the opening price not printed until trading begins? I'm hoping to know what the opening price will be before trading starts

The open price is the price of the first trade of the session which meets the exchange's conditions for setting the last price.

Michael,

If you "know what the opening price will be before trading starts" then wouldn't that be a look-ahead bias in the backtest? Or am I missing something?

Grant