'Market On Open' orders / Poor Performance from Quantopian

Is there some way to place Market On Open orders? Or to place an order before the day starts so it executes immediately? (A couple responses I saw in other comments seems to make me think this cannot currently be done.)

The first and last minutes of the day often seem to have some of the most dramatic swings. As such, an order placed a minute or two after the market opens can be significantly different from the opening price.

For example, I ran a quick algorithm that used the schedule_function to buy first thing in the morning and sell at the end of the day. The close price is aright at the closing time, but the opening prices that I got are usually 2 minutes after the market opens. Here are the prices I got (along with the Open & Close data from Yahoo Finance and the differences) for the week of July 13-17. (The columns are a little misaligned)

DATE    O(Yahoo)    C(Yahoo)    O(Quant)    C(Quant)    Delta(O)    Delta(C)
2015-07-13  208.99  209.76  209.11  209.73  0.12    -0.03
2015-07-14  209.72  210.72  209.81  210.65  0.09    -0.07
2015-07-15  210.73  210.63  210.64  210.6   -0.09   -0.03
2015-07-16  211.87  212.27  211.84  212.22  -0.03   -0.05
2015-07-17  212.29  212.47  212.16  212.42  -0.13   -0.05


The opening prices that I get are up to \$0.13 off that week-- sometimes high; sometimes low. The Closing prices are closer -- within about a nickel. Unfortunately, the algorithm I have dreamed up and tested in a spreadsheet draws heavily on Open & Close prices (mostly because they are freely available). As such, the results using Quantopian will be much different different from the spreadsheet's calculations.

PS. A second related question (but not related specifically to Quantopian). If I had placed Market on Open orders with a broker, could I have expected to have gotten the quoted values for the Open & Close? Or would I have gotten a price that might be off a few cents. (Assuming my order would not have been big enough to influence the market).

Tim

4
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 55bb6d473432d60c612fe43e
There was a runtime error.
3 responses

Is there some way to place Market On Open orders? Or to place an order before the day starts so it executes immediately? (A couple responses I saw in other comments seems to make me think this cannot currently be done.)

No and no. Enjoy:

Thanks for the feed-back. Alexis. It sounds like neither of us are likely to be able to use our strategies as we originally envisioned (at least not soon). I might be able to do well enough trading 9:31 - 4:00 each day. My strategy was returning over 30% annual return for SPY since 1993 (better some years; worse others) in a spreadsheet (with no expenses, but also no dividends). So if it looses a little effectiveness here, it should still be good (once I figure out he rest of the details of Python).

PS, Alexis, you might want to rethink "My strategy uses daily bars and enters each trade at the market open and exits at the close. " Here is a hint I have discovered.

Many stocks do better overnight than during the day. For example, since SPY was created in 1993, the overall returns are 4.63x (not counting dividends). However, the returns from open-to-close are 0.75x and the returns from close-to-open are 6.14x. So someone could have beating the market by about 33% over those 20+ years simply by exiting the market during the day and only investing overnight! Investing just during the day would have LOST money!

Or for the last ~ 2 year, SPY is up ~25%, but ~19% of that came overnight and only 5% during the day. So for that period, getting out during the day was not a good strategy, but nighttime was definitely better. maybe you can bump up your returns by going long every night instead of getting out. :-)

Hey Timothy, I am aware that overnight and day session returns are often like night and day. :) It's actually an area of research I've been working on for some time (which explains my frustration with Quantopian's lack of MOO/MOC orders handling). And it's a fascinating one (who doesn't like the thought of sleeping while making money?!). Be careful though when you omit trading costs in your backtest, because they will kill you in a low-volatility environment. They are very significant in overnight trading since even if you're right about the direction of the return, you need enough amplitude (ie, volatility) to turn it into a profit after including trading costs.