Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Is it possible to trade at market open?
schedule_function(ordering_logic,date_rule=date_rules.every_day(),time_rule=time_rules.market_open(hours=0, minutes=0))  

When the earliest trade can be made ?

8 responses

From my experience, in live trading your earliest trade will be placed at 9:31 (i.e. not at market open which is 9:30).

Note also that all open orders after the close are cancelled automatically; they will not remain in place and be filled when trading resumes the next day.

The earliest an order can be placed is 9:31.
Why is that not 9:30 (market open)?

I think its because to get the open data you have to wait until 9:30. And since Q only runs every minute, the next point in time you can execute after the open is 9:31.

thank you guys

Why is that not 9:30 (market open)?

Why there is a 1 minute delay is not so clear. I think it has to do with some of the underlying mechanics of the Quantopian trading system. Perhaps Quantopian support can confirm, but I suspect that the 1-minute delay allows a determination of which stocks within the requested universe will be trade-able for the coming day. Other elements of setting up the required algo data feed may require the market to be open, as well.

Grant - I am not sure I would call it a "delay". Q only handles minute level data, they dont do tick level data. Why they dont do tick level data is another whole discussion.

But knowing that they execute every minute, on the minute, then at 9:30, they cannot execute orders because they dont have the open price. So they have to wait - say 0.1 seconds - to get the data for open prices. At this point, 9:30 on the minute has passed, so they have to wait until the next interval at which they execute trades, which is about 1 min later, i.e. 9:31. I would not call this a "delay", this is just how the Q platform executes.

It could be debated that instead of executing on the minute, maybe they should execute 1 second after the minute, so as to potentially solve this problem.

@ Mohammad -

The question has come up before, and as I recall, Quantopian support responded something to the effect of wanting to protect traders, since as you say, the opening price is not available until 9:31. I kinda think that there is more to the story. Perhaps if y'all are listening, somebody at Quantopian could flesh out the details here. It would also be interesting to understand how Quantopian will eventually implement trading at (or near) the open.