> For the complete documentation index, see [llms.txt](https://docs.kryptox.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kryptox.finance/trading/order-types-and-matching.md).

# Order Types & Matching

#### **Market Orders** <a href="#market-orders" id="market-orders"></a>

A market order is an order that executes immediately at the current market price for a given position size. Users can set an average execution price to limit how much their execution price can deviate from the mid-price of the order book. If there is insufficient liquidity in the market, or if subsequent fills would cause the average execution price to exceed the set limit, the market order will be partially filled.

**Execution options**

* The **Reduce-Only** execution option ensures that changes to the position only move it closer to zero, regardless of whether the position is positive or negative.

#### **Limit Orders** <a href="#limit-orders" id="limit-orders"></a>

A limit order is a buy or sell order that executes at the limit price user sets or better. Limit orders also support enhanced order options like expiration and execution instructions.

**Execution options**

* The **Reduce-Only** limit order reduces the position size towards zero, executing partially if the order size exceeds the position, with any remaining portion canceled once the position reaches zero.

**Time in Force**

Time-in-force options allow users specify the lifetime of an order.

* **Good ‘Til Time** option allows users to specify a time until which the order remains valid. If the expiry time of an active order in the order book passes, the exchange automatically cancels the order.
* **The Immediate or Cancel** option automatically cancels an order if it is not immediately filled. These orders are not placed into the order book as maker orders.
* The **Post-Only** execution option ensures that a limit order is placed only as a maker order. If there are crossing orders on the opposite side of the order book at the time of placement, the exchange automatically cancels the post-only order to prevent it from becoming a taker order. If no crossing orders are present, the order is inserted into the order book. This guarantees that the order acts only as a maker and will pay maker fees for any trades.

#### Order Matching <a href="#order-matching" id="order-matching"></a>

When matching orders, KryptoX uses a price-time priority system. When a new order is placed as the taker, the KryptoX Matching Engine finds the highest-priority order on the opposite side of the order book, meaning the order with the best price. If there are multiple orders with the same best price, the oldest one is selected. The matching engine then executes the trade at the maker’s price. If the taker order is not fully filled, this process continues until the taker order is completely filled or until there are no more crossing orders. If the taker order is a limit order that needs to be placed in the order book, the KryptoX Matching Engine inserts it on the corresponding side.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kryptox.finance/trading/order-types-and-matching.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
