I just started at Quantopian and have searched the forum extensively for an answer to this question, but couldn't find one.
I get a runtime error for the "order_target(context.future, 0)" below. I want to trade ES. It says that "UnsupportedOrderParameters: Passing non-Asset argument to 'order()' is not supported." Why do I not get a runtime error for the buy orders, but for the sell order, even though I basically use the same argument?
if current_price > (1.005 * average_price): # Place the buy order (positive means buy, negative means sell) order_target_percent(context.future, 1) log.info("Buying %s" % (context.future.symbol)) elif current_price < average_price: # Sell all our positions by setting the target position to zero order_target(context.future, 0) log.info("Selling %s" % (context.future.symbol))