> For the complete documentation index, see [llms.txt](https://docs.aftermath.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aftermath.finance/perpetuals/architecture/order-types.md). Agents can also search and read this documentation through its [MCP server](https://docs.aftermath.finance/~gitbook/mcp).

# Order Types

All orders are matched using price-time priority. At the same price level, earlier orders fill first.

* ***Market orders:*** You choose the amount to trade, and the order fills completely at the best prices on the orderbook. If the whole amount can't fill within the order's max slippage, nothing fills and the order is cancelled.
* ***Limit Orders:*** You choose the amount to trade and the price to trade at. Behavior depends on the limit order type:
  * *Standard:* The amount is filled until the chosen price. The unfilled amount is placed as a pending order on the orderbook.
  * *Fill Or Kill:* The order must fill completely until the price, or the transaction aborts.
  * *Post Only:* Places the order on the book with no fills. If the order would immediately match against existing liquidity, the transaction aborts. Use this to guarantee maker fees.
  * *Immediate Or Cancel:* The order is filled until the chosen price, the unfilled amount is canceled and returned to the account.
* ***Stop Market Order:*** Triggers a market order when the trigger price crosses your stop price. A stop price above the current price waits for a rise, and one below waits for a fall. The trigger price source is chosen per order: [mark price](https://docs.aftermath.finance/perpetuals/architecture/liquidations.md#mark-price) (default in the app), index (oracle) price, or book mid price.
* ***Stop Limit Order:*** Triggers a limit order when the trigger price crosses your stop price, with the same choice of trigger price source. The limit order fills at your limit price or better, so a fast move can pass it without a fill.
* **Scale Order:** Distributes a total size across multiple limit orders evenly spaced between a start and end price. Useful for building order grids, DCA-style entries, or liquidity ladders in a single transaction. An optional size skew parameter controls whether the distribution is uniform or weighted towards one end of the price range. Each order fills on its own.
* **One Triggers Other (OTO):** Place a limit order with an attached SL/TP at creation time. The SL/TP is linked to the limit order and only becomes active once the limit order is matched and a position is opened. Placing SL/TP on an existing position is a separate feature.
* **TWAP Order:** Splits a large order into equal-size chunks executed at regular time intervals, tracking the time-weighted average price and reducing market impact. Each chunk executes as an immediate-or-cancel order bounded by a maximum slippage around the mark price, so chunks take liquidity and never rest on the book. Any amount a chunk fails to fill carries over into later executions. The order's size, direction, and schedule are stored onchain only as a salted hash and stay private until execution. You can give a TWAP order an expiry. Canceling it at any time refunds the unused gas allocated for its execution. In the app, a TWAP order needs a max slippage above 0%, and the order form does not place one whose margin is more than your available collateral (**Not enough collateral**).
* **LWAP Order:** Splits a large order into slices sized by the depth on the order book. A slice fires only when the book has enough depth within the order's slippage per slice, so slices are larger when the book is deep and wait when it is thin. A max price (buy) or min price (sell) is set from the arrival price, the mark price when the order is placed, and defaults to twice the slippage per slice. Slices pause while the mark price is past it and resume if the price returns. After the max wait, anything unfilled is cancelled. LWAP works with Reduce Only. The order holds a gas deposit in SUI that pays the executor for each slice, and unused gas is returned. See [Placing an LWAP Order](https://docs.aftermath.finance/perpetuals/tutorials/placing-an-lwap-order.md).
* **Atomic Order:** Trades several markets at once. One amount of margin is split by weight across 2 to 20 legs, one per market, each long or short with its own leverage. Every leg is a market order, and all legs are placed in one transaction: if any leg can't fill in full within the max slippage, none of them fill. An atomic order can also run over time as a TWAP basket, where each slice trades every leg together or none, or as an LWAP basket of up to 10 legs that fill in step as the books refill. See [Placing an Atomic Order](https://docs.aftermath.finance/perpetuals/tutorials/placing-an-atomic-order.md).

#### Modifications

* Reduce only: When enabled, the order can only reduce or close an existing position. It never increases your position size or opens a new one. Use it as a safeguard when closing or scaling out of trades.
* Expiry: Sets a time limit on the order. If the order has not fully filled by the expiry time, it is cancelled. Use it for time-sensitive strategies where stale orders become a risk. In the app, a TWAP order run to an **End time** expires at that time, and an LWAP order cancels whatever hasn't filled after its **Max wait**. The app's order form does not set an expiry for other order types; use the API or SDK.

## In the app

The order form has **Market**, **Limit**, and **Pro**. **Pro** opens a menu of the other order types:

* **Conditionals:** **Stop Market** and **Stop Limit**.
* **Advanced:** **Scale**, **TWAP**, **LWAP**, and **Atomic**.

<figure><img src="https://3284144787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmeKfXaQnIP3bbI1AdlVX%2Fuploads%2Fgit-blob-5c5c56234edffc27b02e913f10cb2c28ec81d05f%2Fperps-pro-menu.png?alt=media" alt="Pro menu with Conditionals and Advanced order types, including LWAP" width="375"><figcaption><p>Pro menu</p></figcaption></figure>

**Limit**, **Scale**, and **Stop Limit** have an **Order type** setting: **Standard**, **Fill or Kill**, **Post Only**, or **Immediate or Cancel**. **Market**, **Stop Market**, and **TWAP** show **Max slippage**. **LWAP** shows **Slippage per slice**.

**Take Profit / Stop Loss** can be turned on for **Market** and **Limit** orders only, and not together with **Reduce Only**. See [SL/TP](https://docs.aftermath.finance/perpetuals/architecture/sl-tp.md).

### Stop Market and Stop Limit

Enter a **Stop Price**, and for **Stop Limit** also a **Limit Price**. **Trigger price** chooses the price the stop watches: **Mark Price** (default), **Index Price**, or **Book Mid Price**. Open stop orders appear in the **Stop Orders** tab below the chart.

### Scale

Enter a **Start Price**, an **End Price**, the number of **Orders**, and the total size. **Size Skew** is the size of the last order (at the end price) relative to the first (at the start price): 1.0 spreads the size evenly, and 2.0 makes the last order twice the size of the first.

### TWAP

* **Duration** or **End time:** how long the order runs, from 1 minute to 30 days. Enter hours and minutes, or pick a date and a time.
* **Trigger:** optional. The order waits to start until the mark price reaches this level. A level below the current mark waits for a fall, and one above waits for a rise. Waiting does not extend the end time.
* **Max price** (Long) or **Min price** (Short): optional. Slices wait while the mark price is above your max price on a buy, or below your min price on a sell, and resume when it returns. The check uses the mark price, not your fill price. Waiting does not extend the end time, so an order that waits can finish with less filled.
* **Randomize:** varies each slice's size by up to 30% and its timing by up to 40%, so the schedule is not predictable. Slices still respect the max per slice.
* **Advanced TWAP settings:** **Slice frequency** (how often a slice runs; 30 seconds by default), **Max per slice** (the largest slice, as a percent of the total order), and **Tail merge** (a remainder smaller than this share of a slice is merged into the final slice). Leave it off to use the defaults.
* **Max slippage:** how far past the mark price a slice may fill. A slice that would fill past it is skipped.

The preview shows the **Schedule** (one slice every interval, and the number of slices) and the **Size per slice**. Gas scales with the number of slices, so the form warns when an order has a very large number of slices.

Running and finished TWAP orders appear in the **TWAP Orders** tab. See [Maintaining your Positions](https://docs.aftermath.finance/perpetuals/tutorials/maintaining-your-positions.md#twap-orders).

### LWAP

* **Slippage per slice:** how far past the mark price one slice may fill, from 0.01% to 99.99%. It starts at your **Max slippage**.
* **Max price** (Long) or **Min price** (Short): set as a percent or a price from the arrival price, from 0.01% to 99.99%, and no tighter than the slippage per slice. The default is twice the slippage per slice.
* **Max wait:** 10m, 30m, 1h, 4h, or a custom time from 5 minutes to 23h 50m. The default is 30 minutes.

An LWAP order must be worth at least $100, or the market's minimum order value if that is higher. The preview shows **Impact per slice**, **Impact all at once**, and the **Gas deposit**. Running and finished LWAP orders appear in the **LWAP Orders** tab. See [Placing an LWAP Order](https://docs.aftermath.finance/perpetuals/tutorials/placing-an-lwap-order.md).

### Check your order

To see a summary before an order goes to your wallet, open Settings, then **Trading**, then **Confirmations**, and turn on **Placing orders**. It is off by default. The order button then reads **Review long** or **Review short** and opens **Check your order**, which shows the order type, size, price or trigger, take profit and stop loss, Reduce Only, the TWAP schedule, the estimated fees, and, for Market and Stop Market orders, the liquidation price and max slippage. Click **Back** to return to the form, or the confirm button to place the order. Atomic orders have their own setting, **Placing atomic orders**.

### How order types work

The app explains every order type with an animated chart. To open it:

* Open **Pro** and click **How order types work** at the bottom of the menu.
* With a mouse, rest on a **Pro** item to see a preview beside the menu, then click **Learn more**. On a touch screen, tap ⓘ next to the item.
* Press **H** anywhere in the trading screen outside a text field.

<figure><img src="https://3284144787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmeKfXaQnIP3bbI1AdlVX%2Fuploads%2Fgit-blob-c3c5c04f517a8249ff793d87170cdeff034d7149%2Fperps-order-types-guide.png?alt=media" alt="Order types guide showing LWAP with its chart animation" width="563"><figcaption><p>Order types guide</p></figcaption></figure>

The guide lists **Market**, **Limit**, **Stop Market**, **Stop Limit**, **Scale**, **TWAP**, **LWAP**, **Atomic**, **TP / SL**, **Reduce Only**, **Post Only**, **Fill or Kill**, and **Immediate or Cancel**. Each shows a summary, an animation for a long or a short, and three key facts. Use the up and down arrow keys to move through the types, and the left and right arrow keys to switch between long and short. The button at the bottom sets the order form to that type and side. You still place the order yourself.

The guide also appears in two other places. The first time you choose **Stop Market**, **Stop Limit**, **Scale**, **TWAP**, **LWAP**, or **Atomic**, a note above the order button links to it. When a Post Only order would match right away, or a Market or Fill or Kill order can't fill in full, a **Why?** link under the error opens the matching type.
