Back to Posts
Listen to Thread

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
5
Loading...
Backtest from to with initial capital ( data)
Cumulative performance:
Algorithm Benchmark
Custom data:
Week
Month
All
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Information Ratio
--
Benchmark Returns
--
Volatility
--
Max Drawdown
--
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
Information Ratio 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
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.

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:

http://individuals.interactivebrokers.com/en/software/tws/usersguidebook/ordertypes/time_in_force_for_orders.htm

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!

thanks,
fawce

Log in to reply to this thread.
Not a member? Sign up!