Submitted by hansfriese, also found by bin2chen
The open price of a stop order might be changed during execution but it doesnt validate StopLoss/TakeProfit for the changed price.
As a result, the executed market order might be closed immediately and there would be an unexpected loss for users.
As we can see from executeLimitOrder(), the open price might be changed to the current price for the stop order.
But it doesnt validate sl/tp again for the new price so the order might have an invalid sl/tp.
The new price wouldnt satisfy the sl/tp requirements when the price was changed much from the original price due to the high slippage and the order might be closed immediately by sl or tp in this case.
Originally, the protocol validates stoploss only but I say to validate both of stoploss and takeprofit. (I submitted it as another issue to validate tp as well as sl).
Recommend validating sl/tp for the new trade.price in Trading.executeLimitOrder().
TriHaz (Tigris Trade) disputed and commented:
Alex the Entreprenerd (judge) commented:
TriHaz (Tigris Trade) confirmed and commented:
Alex the Entreprenerd (judge) commented:
GainsGoblin (Tigris Trade) resolved:
