# Order Types

### Overview

Ostium supports seven distinct order types designed to provide traders with execution experiences similar to traditional markets. These order types are categorized into two fundamental execution mechanisms:

1. **Market Orders** — Triggered by the mid-price and executed at the bid/ask price or Price-After-Impact
2. **Limit Orders** — Triggered by the mid-price selected by the user and executed at the bid/ask price or Price-After-Impact

{% hint style="info" %}

## Price-After-Impact

Some pairs might have **Dynamic Spreads** enabled, meaning that instead of using the bid or ask price, trades execute at the **Price-After-Impact**, which adjusts in real time based on short-term net buy and sell pressure—allowing zero-spread execution under balanced conditions and applying impact costs only when order flow becomes one-sided. Click [here](https://ostium-labs.gitbook.io/ostium-docs/dynamic-spreads) learn more.
{% endhint %}

### Open Trade Orders

Ostium supports three types of orders for opening positions:

#### Open Market

* **Trigger**: Most recent mid-price (immediate execution)
* **Execution**: At bid/ask price or Price-After-Impact
* **Classification**: Market order
* **Behavior**: Order is triggered immediately after the request is received onchain
* **Rationale**: This is a textbook market order, providing immediate execution at the current market conditions

#### Open Limit

* **Trigger**: At bid/ask price or Price-After-Impact crossing user's limit price
* **Execution**: At bid/ask price or Price-After-Impact that crossed the limit
* **Classification**: Limit order
* **Behavior**: Ensures execution only occurs when the trade can be filled at the limit price chosen by user or better
* **Rationale**: The mid-price crossing the limit is insufficient; execution only occurs when the actual trade price reaches the limit, ensuring the user gets their desired price or better

#### Open Stop

* **Trigger**: Mid-price crossing user's stop price
* **Execution**: At bid/ask price or Price-After-Impact
* **Classification**: Market order
* **Behavior**: Functions as a market order once triggered
* **Rationale**: Follows market conventions where traders expect stop orders to be triggered as market orders. Traders can use limit orders instead if they want to ensure execution at specific prices

### Close Trade Orders

Ostium supports four types of orders for closing positions:

#### Close Market

* **Trigger**: Most recent mid-price (immediate execution)
* **Execution**: At bid/ask price or Price-After-Impact
* **Classification**: Market order
* **Behavior**: Equivalent to Open Market order
* **Rationale**: Provides immediate position closure at current market conditions

#### Take-Profit (TP)

* **Trigger**: At bid/ask price or Price-After-Impact crossing user's TP price
* **Execution**: At bid/ask or Price-After-Impact
* **Classification**: Limit Close order
* **Behavior**: Equivalent to Limit Open order
* **Rationale**: Ensures position closure at a higher price in the future

#### Stop-Loss (SL)

* **Trigger**: Mid-price crossing the user's SL price
* **Execution**: At bid/ask or Price-After-Impact
* **Classification**: Market order
* **Behavior**: Equivalent to Limit Open order
* **Rationale**:  Ensures position closure at a lower price in the future

#### Liquidation

* **Trigger**: Mid-price crossing the calculated liquidation price
* **Execution**: At bid/ask or Price-After-Impact
* **Classification**: Limit Close order
* **Behavior**: Equivalent to Stop Loss order
* **Rationale**: Ensures automatic position closure when margin conditions are breached. Uses limit-style execution to prevent unnecessary liquidations during transient volatility, while Ostium’s liquidation backstop mechanisms cover residual market risk.

### Summary

| Order Type   | Classification     | Trigger                                            | Execution                            |
| ------------ | ------------------ | -------------------------------------------------- | ------------------------------------ |
| Open Market  | Market Open Order  | Mid-price (immediate)                              | Bid/Ask or Price-After-Impact        |
| Open Limit   | Limit Open Order   | Bid/ask price or Price-After-Impact crossing limit | Bid/ask price or Price-After-Impact  |
| Open Stop    | Market Open Order  | Mid-price crossing stop                            | Bid/Ask or Price-After-Impact        |
| Close Market | Market Close Order | Mid-price (immediate)                              | Bid/Ask or Price-After-Impact        |
| Take-Profit  | Limit Close Order  | Bid/ask price or Price-After-Impact crossing TP    | Bid/ask or Price-After-Impact impact |
| Stop-Loss    | Limit Close Order  | Mid-price crossing SL                              | Bid/Ask or Price-After-Impact        |
| Liquidation  | Limit Close Order  | Mid-price crossing liquidation price               | Bid/Ask or Price-After-Impact        |
