Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Good-til-Cancelled orders for live trading

Hi,

Your API documentation states the following:

"All orders are good-til-cancelled, except for algorithms that are connected to a brokerage. Orders placed with a brokerage (both paper trading and real-money trading) are cancelled at end-of-day."

Are there any plans for making it possible to send good-til-cancelled orders on live trading as well? Are there any fundamental technical constraints preventing this implementation?

Thanks

1 response

Hi Burak,

This is one of the few differences in behavior between backtesting and live trading.

In backtesting, orders persist day-after-day until they are filled or cancelled. In live trading, all orders are submitted to IB with an expiration time of 4PM. Meaning any open orders at the end of each trading day will get cancelled.

You can get around this with some clever code in your algorithm. You can use the get_order() function to query for unfilled orders every morning or use the portfolio object to check the number of positions held. Then, you can re-submit any remaining orders on the next day market open at 9:31AM.

We initially created this architecture to protect algorithms against wild price swings during non-market hours. We added order styles that were broker-agnostic, so that we can more easily add new brokers to the platform. The request for GTC orders is one another customer has mentioned, but it's not currently on the near horizon. As a startup, we have the robustness to quickly shift gears, so our priority list is flexible and we're always listening to your requests and feedback.

Best wishes,
Alisa

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.