Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Why is LimitOrder filling like a MarketOrder ?

Why are limit orders being filled on the very next minute bar regardless of what price they are set to ??

Here is the code (I can't attach the backtest for some reason)


def initialize(context):
pass

def handle_data(context, data)
spy = 8554
order(sid(spy), +10, style=LimitOrder( 9999.9 )) # set limit order WAY above current price, it should never be filled
print context.portfolio.positions[spy].amount # however my position does keeps increasing


2 responses

A LIMIT order executes at the specified price or better.
SPY price is well under 9999.9 and therefore your order is always filled.

Yes. I should have been using a stop order. Thanks