Order Types

Content Out of Date

This content is not maintained and refers to an out-of-date version of Perpetual Protocol.

For the latest documentation, see https://docs.perp.com

Use Perp v3 for limit orders.

Limit orders on Perp v2 rely on local liquidity and are not connected to Smart Maker. This makes is very likely for Perp v2 limit orders to fail to trigger as expected.

What is a Limit Order?

Limit orders can now be submitted through our UI, API, or smart contract.

Limit orders use a limit price trigger for market buys or sells at a particular price, allowing you to enter or exit a position at your limit price or better.

For example, if you're bullish on ETH and want to buy at a lower price than it's currently worth, you can submit a limit order to buy 10% lower than the current price. Once the mark price falls and crosses the limit price, you'll automatically buy ETH without having to manually execute the trade.

This is different to a market order, which only lets you buy or sell immediately at the best available price. It’s important to remember that while market orders prioritize time, limit orders prioritize price.

So if you want to quickly get into a position and you’re not sensitive to the price, then a market order is best. On the other hand, if you want to open a position at a certain price and you’re not sensitive to the timing, then you should use a limit order.

Limit order tl;dr

Key points to know when using limits & stops:

  • Limit orders on Perp are executed as market orders when triggered.

  • Fill price must equal your trigger price (or better), taking into account price impact⁠—therefore your trigger price appearing on the chart does not guarantee your order will be filled⁠.

  • There are no partial fills⁠—an order must be able to fill 100% at the set price.

  • Stop-loss limit orders trigger on index price, and then execute as normal limit orders (trigger on mark price).

  • Limit orders with the same trigger price execute in random order (whichever order DynamoDB finds first will trigger first)⁠.

  • During strong price movements, some orders may cause the per-timestamp price change limit to be exceeded. An order may not fill if this is the case.

The benefits to traders include:

  • Improved risk management

  • Automate your trading

  • Enable more sophisticated trading strategies

Unlike on centralized exchanges, limit orders are automated market orders that use the liquidity provided by makers.

An off-chain database (LimitOrderBook) stores limit orders, where a keeper bot monitors new limit orders and sends a transaction for you once the trigger condition has been met. The off-chain order book will be opened up in the future so that anyone can run their own keeper bot and execute limit orders for traders.

Enabling Limit Orders

To start using limit orders, there is a one-time approval that must be completed, where you must approve the LimitOrderBook contract to open positions.

Change order type to "Limit" and click on “Approve Limit Order”. This only needs to be done once. If you see Approve Limit Order again, please refresh the page.

Placing a Limit Order

Limit orders have a minimum position requirement of $100.

Once changing the order type and choosing long or short, you can then enter your limit price in the price field and decide on the position size in the amount field (or via the buying power slider).

The expiration of the limit order can be modified. Select from the options from the dropdown menu by clicking on the clock icon (options vary between 5 minutes and one week).

Click on “Confirm Limit Order”. The submission of the limit order is done off-chain, so you’ll just have to submit a signature from your wallet and there are no gas or trading fees when submitting limit orders.

Once you’ve provided your signature, the order will appear under the Limit Orders tab until it is executed.

When the mark price (plus price impact) reaches the limit price, the order will be executed and your position will be opened. You do not pay any trading fee until the filing of your limit order. Gas fees are paid for by the keeper bot.

The execution price of a limit order may differ depending on slippage and execution may depend on liquidity.

There are no partial fills with advanced order types and limit orders will either be fully executed or not at all. Once a limit order has been executed it will be shown in the fills column and in your transaction history.

Canceling a Limit Order

If you want to cancel a limit order before it has been executed, then click on "Cancel" and confirm in your wallet. As mentioned above, cancellations are done on-chain so you will need to pay a gas fee.

You can also prevent a limit order from executing by removing liquidity, or reducing your position size if you used Reduce Only, causing the limit order to fail if the trigger price is reached.

Reduce-only Option

There’s also a reduce-only option for limit orders, which can be used whenever you want to strictly reduce the size of an open position. For example, if you are long ETH-USD, you can use a reduce-only order to sell to make sure it only partially or fully closes the existing long position. This would prevent a short from opening in the event the position was liquidated or otherwise reduced in size prior to the limit order executing.

To submit a reduce-only limit order, you must already have an existing position for a given asset.

Tick the checkbox next to "Reduce Only" on the UI before submitting the order.

A new slider will appear. 'Buying power' is now replaced with 'position size' when using the reduce-only option, prompting you to specify the percentage of your existing position you want to close:

Click on "Confirm Limit Order" and it will be submitted. This order will only ever decrease the size of your existing position, unlike a standard limit order which will be executed once the market price reaches the limit price.

Price Impact & Slippage

  • Slippage: unexpected difference in price between creation and execution of an order.

  • Price impact: expected movement of price caused by a trade, given current liquidity.

As with market orders, limit orders may be affected by slippage and price impact. Depending on market conditions, the fill price may differ slightly to the limit price (slippage), and depending on liquidity, your order may not get filled when expected (price impact).

Slippage may have an impact on the execution and timing of your limit orders. If there’s a rapid price movement, the order may fail due to slippage being higher than the slippage tolerance you have set.

Price impact may have a similar effect. If there is a change in liquidity, or liquidity is low, your order may not be able to fill at the set price and will not execute (the system does not support partial fills).

The likelihood of a fill depends on the position size of the order and our liquidity. If the order is too large, the price impact may put the execution price outside of the trigger threshold. Let’s look at an example to illustrate.

Suppose you want to place a limit order at $3 for APE-USD with position size of 3,500 APE. The price impact at the current price is 1.095%, which can be seen by entering the details for your limit order as a market order.

Assuming the level of liquidity is the same around the current price and your limit price, with a limit price of $3 and a price impact of 1.095%, this limit order will push the mark price to $3 * 1.01095 = $3.03285. Because of the price impact, the mark price must cross below $2.96715 ($3 * 0.98905) to fill the limit order.

However, the level of liquidity may be different at the limit price you desire. If there’s less liquidity around your limit price than the current price, there will be a greater price impact, and the mark price required for a fill will diverge more from the limit price set.

You can check the charts listed here for a market’s pool to see the liquidity distribution.

In the case where the mark price meets your limit price, but because of price impact it is not executed, you will see the following note under the limit order tab:

Limit price not met by market price. Reduce order size or adjust limit price to increase fill chance.

At this stage, users can just wait, or cancel the order.

Errors

What is a Stop Loss Order?

The terms Stop Loss and Stop Loss Limit are used interchangeably in our docs. Currently, Perp v2 only supports limits and stop loss limits as advanced order types.

A stop loss limit order is a conditional order that allows traders to set a trigger price at which a limit order to buy or sell is submitted, enabling greater precision when executing a trade. Once the trigger price is reached, the stop loss order becomes a standard limit order that will execute at the limit price or better.

Stop loss orders are used to manage risk. Traders can define the maximum loss of a trade beforehand. The stop-loss limit order type on Perp v2 is designed similarly to FTX's.

For example, you think that any bullish price action will be invalidated if the price falls below $950 and a long position of 1 ETH was opened at $1,000. A stop loss limit order with a limit price of ~$950 and a trigger price at $960 can be used to limit the risk of the long position.

If the index price falls below $960, then a stop loss limit order is sent to sell ETH and unwind the long position once market reaches the limit price of $950. The stop loss limits risk in the case where the price falls even further.

How to Submit a Stop Loss

Change the order type to "Stop Loss Limit".

  • When selecting "Long" + "Stop Loss Limit", this order combination assumes you already have an existing short position. When the index price exceeds the trigger price, the limit order will be sent.

  • When selecting "Short" + "Stop Loss Limit", this order combination assumes you already have an existing long position. The limit order will be sent once the index price drops below the trigger price.

Stop Loss Limits have a minimum position requirement of $100.

Enter the trigger price and limit price. Input the size of the position using the amount field or the buying power slider.

As with limit orders, there are several expiry options for stop losses between 5 minutes and one week. The expiration option can be changed by using the dropdown menu (click on the clock icon).

Submit the stop loss using the "Confirm Limit Order" button and sign the transaction in your wallet.

There are no gas or trading fees to submit stop loss orders.

Once the index price crosses the trigger price, the stop loss is submitted as a limit order. The stop loss will close out your existing position once the mark price reaches the limit price. Trading fees are not paid from your account balance until the stop loss has been filled.

There are no partial fills, so stop losses will either fully execute or not fill at all. Once a stop loss has been filled, it will be shown under the Fills column and in your transaction history.

Cancelling a Stop Loss

All stop loss order cancellations are done on-chain, so there's a gas cost involved.

Active stop losses are displayed under Limit Orders tab, where you can view important details about the order, as well as a "Cancel" button.

After clicking "Cancel", confirm the transaction in your wallet and pay the required gas fee to cancel the order. Shortly after the transaction is confirmed, the stop loss order will be removed.

Slippage

As with market orders, stop loss orders may incur slippage. Depending on liquidity and market conditions, the fill price may differ slightly to the limit price. Also, an order will only get executed if it matches the user’s specified conditions/requirements, including price, amount, and expiration date.

If the price impact of an order is great enough to cause the mark price to be pushed away from the limit price, then the order will not be executed.

Example: a stop loss limit order to sell ETH is set with a limit price of $1,000 and trigger price of $1,005. If the size of the order is too large compared to the available liquidity, and results in slippage of more than 0.5%, then the stop loss limit will not be executed. Once the index price drops below $1,005, the limit price of $1,000 for this order is not feasible due to the slippage and the specified price of the stop loss order isn't matched by the market price.

In this case, the mark price will have to be below the limit price by an amount that allows the order to be triggered without putting the final open price above the specified limit price. E.g., the mark price falls to $995, and the order is triggered, since liquidity in the market is sufficient to keep the final opening price below $1,000.

What is a Reduce-Only Order?

Traders can select the reduce-only option when placing an order if they have an open position.

Submitting Reduce-Only Orders

As the name suggests, reduce-only orders can only reduce the size of an existing position. For example, if you hold a long position for BTC, you'll only be able to select the reduce-only option when opening a limit order to sell. You can also choose the percentage of the position you want to reduce (0% to 100%).

If the reduce-only option is used as part of a stop-loss order, it will be triggered by the index price. However, a reduce-only limit order is triggered by the mark price.

So for a limit order, once the mark price crosses the limit price specified in the reduce-only order, your position will be reduced by the amount specified. For example, if you want to close half of your position, you can select close 50% when submitting the reduce-only order.

Once a reduce-only order has been submitted, it will appear in the orders tab and displays "Yes" under the reduce only column.

Why Use Reduce-Only Orders?

To understand why reduce-only option is needed, imagine you set two limit orders to lock in profits or losses for an open position. Assume that for both of these orders the reduce-only option is not selected.

If the price hits the limit order that's acting as a stop loss, it will reduce your position and lock in losses, however, if there's high volatility, then the other limit order may be triggered, forcing you into an unintended position. Since the initial position was already closed and since the reduce-only option was not specified, then the remaining limit order will be executed regardless of whether the original position remains open or has already been closed.

If you increase an existing position, you'll also have to add another reduce-only order to match the size of the position if you want to fully close it out.

Last updated