Back to Community
order submission at end of trading day?

I wrote a simple routine to sort out how the minutely backtester handles orders at the end of the trading day. Here's the log output showing the last minute of 2012-01-03 and the first minute of 2012-01-04:

2012-01-03handle_data:5DEBUG2012-01-03 21:00:00+00:00  
2012-01-03handle_data:6DEBUGndict({'amount': 19450, 'last_sale_price': 411.1, 'cost_basis': 410.99413111835446, 'sid': 24})  
2012-01-04handle_data:5DEBUG2012-01-04 14:31:00+00:00  
2012-01-04handle_data:6DEBUGndict({'amount': 19500, 'last_sale_price': 411.17, 'cost_basis': 410.9946589953141, 'sid': 24})  

Is it correct that the order was submitted on 2012-01-03 and fulfilled on 2012-01-04? This seems correct, since 'amount' goes up from 19450 to 19500.

Is this the anticipated behavior?

Is it typical in live trading that submitted orders are carried over to the next trading day for fulfillment?

Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
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: 50dd8101564b74114a3af450
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.
4 responses

It depends on the instructions used to make the trade. Generally there are two types of orders: market orders, and limit orders. If the backtester uses market orders, then this behavior does not make sense. If the backtester uses limit orders, then it's possible that the expiration time is set to be longer than end-of-day, but I'd still be suspicious.

Thanks Thomas,

The Quantopian help page states:

order(sid, amount)
Places a market order for the given security and the given amount.

The Interactive Brokers site provides some guidance:

Under their classification scheme, it seems that the Quantopian orders would approximate Good-Til-Canceled (GTC).

Are GTC orders typical? Or should the Quantopian backtester default to Day orders (see IB definition in link above)?

I'm not sure if GTC orders are typical, or how common they are. I definitely think that Day orders are more common, because as IB says from your link: "Unless otherwise specified, every order is a Day order." I agree Quantopian should specify what Time-in-force rules are being applied.

Thomas, Grant,

Great catch, thank you.

The orders are Good-Til-Canceled. As we have been working on our live trading interface, order management has emerged as the biggest discrepancy between our simulator and live trading. We need to add limit and stop orders, time in force, access to the current open orders, and order cancellation.

Please let us know if you find other holes!



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.