Apex Docs
Search…
Stop Market vs Stop Limit
It can be difficult to know whether you wish to create a stop market or a stop limit order and this is unfortunately one of the effects of having an order book existing completely on-chain.
Remember that stop orders are often used to close positions when the market moves against a trader.
Suppose Charlie opened a 5 ETH long position with an entry price of 2000 USDC and ETH is currently trading at 2500 USDC. He wishes to protect his position by opening a 5 ETH stop market sell order at 2000 USDC. From the perspective of the smart contract, this looks like Charlie saying "I wish to sell my 5 ETH at any price below 2000 USDC".
It is possible (although extremely unlikely) to imagine the following scenario:
  1. 1.
    Natural trading causes the price of the ETH-USDC contract drops to 2001 USDC (which is not low enough to trigger Charlie's order)
  2. 2.
    A whale / malicious user sees that Charlie has a stop market order and so shorts a large quantity of ETH-USDC causing the price of ETH-USDC to drop to 1000 USDC
  3. 3.
    The keeper bots execute Charlie's order at the current / next available price which is 1000 USDC.
  4. 4.
    The malicious users closes his short and makes a profit from sandwiching Charlie's order.
  5. 5.
    Charlie logs in the next day and realises that his position was closed at a much lower price than he would have expected and then gets very annoyed.
What can Charlie do to avoid this situation? He can use a stop-limit order to specify a limit price for his stop order. In the scenario described above, he may wish to include a limit price at 1900 USDC. This would mean that his order would be executed as soon as ETH trades below 2000 USDC, but it will never be executed at a price below 1900 USDC.
Ok. So stop-limit orders allow you to avoid being victim to a sandwich attack. Why doesn't everybody just create stop-limit orders?
You would need to consider what would happen in different market conditions / market instability. There have been instances where the crypto markets move rapidly in one direction over the course of minutes. It is entirely possible for the price of the ETH-USDC perpetual to drop rapidly from 2000 USDC to below 1900 USDC before Charlie's order can be executed by a keeper bot. If the price drops below the limit price, the order can no longer be executed and therefore Charlie's long position will be kept open. This could be disastrous for Charlie, who may have intended for his position to be closed in this instance to prevent losses from further downward market movement and possibly liquidation.
Ok sir. TLDR; What should I do?
Stop Market and Stop Limit orders will appeal to different users utilising these orders for different reasons. A stop market order will be executed above/below the trigger price but exposes the user to theoretical risks of sandwich attacks. Comparing this to stop limit orders, there is a chance that these orders do not get executed during periods of significant volatility and therefore this poses a different risk to traders.
There are features within the perpetual smart contracts to prevent significant price manipulation. For the majority of users, we expect that stop-market orders are easier to create produce the functionality that most users would expect.
For the more advanced users who wish to have full control over their orders or for traders creating orders with significant notional volume, we would recommend creating a stop-limit order.
Copy link