> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shadowbook.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Order types

> Limit and market orders on the Shadowbook orderbook.

Shadowbook supports two order types. Both are placed on-chain through the same smart contract and can be cancelled before execution.

## Limit order

A limit order executes only when the market price reaches the price you specify. You set an exact price ratio in the datum, and the protocol fills the order when that price is available.

* **Execution fee:** 1.8 ADA (3 x 0.6 ADA)
* **Fills when:** market price reaches your specified price
* **Cancellable:** yes, before execution

Limit orders are useful when you want to buy or sell at a specific price rather than accepting whatever the market currently offers.

> Note: Unlike AMM-based limit orders, Shadowbook executes limit orders as soon as the specified price conditions are met, without requiring the price to move up on the bonding curve to complete the order. This provides users with a superior trading experience and makes Shadowbook as the DEX of choice for placing limit orders.

<Card icon="arrow-right" href="/on-chain-interactions/limit-order" title="Place a limit order">
  Full transaction structure, datum fields, and deposit calculation.
</Card>

## Market order

A market order executes at the current market price. You accept any available price by setting an infinite slippage price in the datum, and the order fills on the next matcher run.

* **Execution fee:** 0.6 ADA (1 x 0.6 ADA)
* **Fills when:** next available matcher run
* **Cancellable:** yes, before execution

Market orders are useful when you want immediate execution and don't need a specific price.

> Note: While Shadowbook manages slippage more effectively by design than traditional AMM DEXs, users can still control their maximum slippage through the slippage settings available in the aggregator UI they use.

<Card icon="arrow-right" href="/on-chain-interactions/market-order" title="Place a market order">
  Full transaction structure, price field setup, and deposit calculation.
</Card>

## Comparison

|               | Limit order               | Market order                 |
| ------------- | ------------------------- | ---------------------------- |
| Price         | Specified ratio           | Any (slippage managed by UI) |
| Execution fee | 1.8 ADA                   | 0.6 ADA                      |
| Fills when    | Market reaches your price | Next matcher run             |
| Beacon prefix | `0x00`                    | `0x01`                       |

## Cancellation

Both order types can be cancelled before execution. Cancelling returns all ADA from the order - including collateral and execution fees - to the user.

<Card icon="xmark" href="/on-chain-interactions/order-cancel" title="Cancel an order">
  How to cancel on-chain orders and reclaim funds.
</Card>
