13min

Perpetual Order Types

Market Orders

A Market Order is an order to buy or sell a given asset immediately at the current Market Price.

  • For a market order, users can pass slippage tolerance (custom, .1%,.5%,1%, inf)
    • this slippage tolerance translates to a limit price versus the current market price
    • if the order cannot be filled completely up to this limit price, the order is not executed and cancelled
  • confirmation modal can show advanced market impact information

Executing a Market Order does not mean the order will execute at exactly the price displayed. The Market Price of an asset may change before the Market Order is executed.

The fee paid depends on whether its a taker or maker order. Maker orders are Limit orders with a 'Post' flag.

See Fees & Rebates and Advanced Orders FAQ for more information

Limit Orders

Drift Protocol supports a number of queued orders types.

These orders take against the dAMM and are executed by a decentralised network of keepers once certain conditions are met (i.e. mark price crosses the specified trigger/limit price). These orders are executed 'best-effort' by the network with special economic incentives designed to mimic the typical execution order seen in a Centralised Limit Order Book (CLOB).

Limit:

A Limit Order is an order to buy or sell a given asset at a specified price.

Users specify a Limit Price they wish to be filled at. If/when the market price moves to cross, the order will partially fill up to this Limit Price every time a keeper executes it. For taker orders, user's resulting Entry Price is guranteed to be equal to or better than the Limit Price specified.

If the "Post" order flag is set, then order will be filled at the specified limit price with a variable rebate (see Fees & Rebates). (The variable rebate comes from the liquidity surplus from the taker fills that cross after accounting for the filler reward, capped at 5bps)

Advanced Orders

Stop Market:

A Stop Market Order is an order to close the position of a given asset if its Mark Price reaches the specified Trigger Price. If this happens, the position is closed at Market Price.

User specifies a Trigger Price, once (or if) the mark price of the asset reaches the specified Trigger Price and a keeper executes it, a Market Order to sell the asset will be executed.

Stop Limit:

A Stop Limit Order will only execute where the Mark Price of a given asset reaches the Trigger Price. If this happens, a Limit Order at the specified Limit Price will be placed. Once triggered, the resulting Limit Order may be immediately filled or may rest until the specified Limit Price is reached and executed by a decentralised keeper.

User specifies a Trigger Price and a Limit Price, once (or if) the mark price of the asset reaches the specified Trigger Price and a keeper executes it, a Limit Order will be placed at the specified Limit Price.

Stop Limit Orders also serve as a max slippage tolerance for the Stop Order.

Curent Position

Order Type

Trade Direction

Trigger Condition

Reduce Only

Long

Stop (Market If Touch)

Buy

Below

False

Long

Stop

Sell

Below

True/False

Short

Stop

Buy

Above

True/False

Short

Stop (Market If Touch)

Sell

Above

False

๏ปฟ

Take Profit:

A Take Profit Order is an order to close the position of a given asset if its Mark Price reaches the specified Trigger Price. If this happens, the position is closed at Market Price.

User specifies a Trigger Price, once (or if) the mark price of the asset reaches the specified Trigger Price and a keeper executes it, a Market Order to sell the asset will be executed.

Take Profit Limit:

A Take Profit Limit Order will only execute where the Mark Price of a given asset reaches the Trigger Price. If this happens, a Limit Order at the specified Limit Price will be placed. Once triggered, the resulting Limit Order may be immediately filled or may rest until the specified Limit Price is reached and executed by a decentralised keeper.

User specifies a Trigger Price and a Limit Price, once (or if) the mark price of the asset reaches the specified Trigger Price and a keeper executes it, a Limit Order will be placed at the specified Limit Price.

Take Profit Limit Orders also serve as a max slippage tolerance for the Stop Order.

Current Position

Order Type

Trade Direction

Trigger Condition

Reduce Only

Long

Take Profit (Market If Touch)

Buy

Above

False

Long

Take Profit

Sell

Above

True/False

Short

Take Profit

Buy

Below

True/False

Short

Take Profit (Market If Touch)

Sell

Below

False

If Trigger Price < Limit Price: order starts getting filled once price is below trigger

If Limit Price < Trigger Price: orders starts getting filled once price is below limit

One limitation is the only way the protocol can detect that a trigger price has beenย hitย is if the order has already been or can be partially filled. This doesn't allow some order configurations to be placed: TriggerIsAbove | DirectionIsLong | LimitPrice ------------------------------------------------ True | True | Must be above trigger True | False | Ok False | True | Ok False | False | Must be below trigger Example: If Trigger Price is >$140 and a Long is placed with a Limit Price = $135, theres no way the order can know that $140 was hit before you try to long when the price falls $5. In the other scenario, if Trigger Price is < $140 and a Long is placed with a Limit Price = $135, we will know that $140 (AND $135) must have been hit since you got partially filled a little bit

Additionally, if the Trigger Price is <$140 and a Long is placed with a Limit Price = $141, both the order will get filled up to $141 once it crosses $140.ย 

Order Flags:

Reduce Only: Enforces that order will never increases or flips the current position.

Post Only: Enforces that order is a maker order that can provide liquidity to the pool for a reduced exchange fee (0%). Without this flag, orders that don't execute immediate are not post only.

Immediate or cancel (IOC): An order is placed and potentially partially filled. The remainder that is not filled immediately is then cancelled.

๏ปฟ

๏ปฟ

๏ปฟ

Updated 04 May 2022
Did this page help?
Yes
No