Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Why orders can't be placed in before_trading_start method?

Last time I checked, it was not possible to execute a market-on-open in Quantopian since the trading algo really starts on the 2nd minute bar.

Since there is now a before_trading_start() method, why isn't it possible to send an order to IB?

Thanks.

4 responses

before_trading_start() takes "context" as a parameter but not "data". This means you can screen your universe and have it setup before the market opens, but there isn't price or order information in that method. It's a way to update your trading universe on a daily basis using fundamental data. Our architecture would need some rewiring to send MOO orders, and we haven't taken that step yet.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Alisa,

Why do orders get cancelled at the end of the trading day, automatically? If you were to allow orders submitted in the last bar of trading of the day, and have them persist overnight, then wouldn't they get filled when the market opens at Interactive Brokers? Or would this require support of an actual MOO order type?

Grant

Alisa,

Any idea when this feature could be implemented? I posted about it a year and a half ago and to be honest, I'm quite surprised (disappointed) that it hasn't been covered yet since MOO are so basic and important in actual trading (at least for me). Thanks!

Hey guys,

To answer your questions:

Why do orders get cancelled at the end of the trading day, automatically?

This was built as a precautionary measure to protect live traders against wild price swings overnight.

Or would this require support of an actual MOO order type?

Yes, it would require specific support for the MOO order. We'd have to build out our integrations to support MOO with IB. And unfortunately this change isn't a couple of code lines.

Any idea when this feature could be implemented?

We get many feature requests each day, most of which we'd love to build. The underlying question is - what gets prioritized? And the answer right now is we're building tools and features that will enable quants to build sophisticated, intelligent strategies for the fund. Our current queue is working on adding futures, support statistical arbitrage, and expanding the research platform. MOO and MOC orders are on the list, but they haven't made it above the fold into the currently active queue. When it makes the jump, I'll keep you folks posted.

Cheers,
Alisa