I am using a limit order in order to prevent slippage.
def placeLimitOrder(context, data, order, firstUnderlyingTarget):
if order != 0:
print("firstUnderlyingTarget: " + str(firstUnderlyingTarget))
order_target(context.firstUnderlying, order * 500, style=LimitOrder(firstUnderlyingTarget))
In the log output, I see
2011-01-07 00:11 PRINT firstUnderlyingTarget: 127.03
However, in the Transaction detail, I see
12:12AM SPY SELL $127.15 500 ($63575)
Wondering why there is a price difference. And the difference is so large.