Skip to main content

Central Limit Order Book

PartyDEX runs a full central limit order book (CLOB) alongside its concentrated liquidity AMM pools. You can place limit orders, immediate-or-cancel orders, and trigger orders (stop-losses and take-profits) — and the protocol's smart routing can split a single trade across both the book and the pools to get you the best price.

Placing an order

Every order starts with tokens you've already deposited into your trading balance. When you place an order, the protocol locks the input amount so it's reserved for that trade — your trading balance decreases immediately.

Say you want to buy BTC with USDT. You submit a limit buy at a specific tick (price level). Two things can happen:

  1. Your price crosses the spread. There are already sell orders sitting at or below your price. The engine matches you immediately — oldest resting orders at each price level fill first. If your entire input is consumed, your order is done. If resting liquidity runs out before your order is fully filled, the remainder rests on the book at your limit tick.

  2. Your price doesn't cross the spread. No sellers are willing to meet your price right now. Your order joins the queue at that tick and waits. When a future seller's order crosses down to your level, you'll be matched in the order you arrived — first in, first out.

The same logic applies in reverse for sell orders.

How matching works (FIFO)

Each tick on the book holds a queue of resting orders. When a new order crosses the spread, the engine walks through opposing price levels starting from the best available price:

  • At each price level, the oldest order fills first. Your order joins the back of the line at its tick, and it moves forward as older orders ahead of you get filled.
  • Matching continues level by level until the incoming order is fully filled, its limit price is reached, or no more opposing orders remain.
  • Partial fills are common — an order can match against several resting orders across multiple ticks in a single execution.

This is a standard price-time priority model, the same mechanism used by traditional exchanges.

Order types as use cases

Limit orders — "I want this price or better"

A limit order is the default. You specify a side (buy or sell), an amount, and a tick. If the market can fill you immediately, it does. Otherwise, your order rests on the book until it's matched or you cancel it.

Use a limit order when you have a target price in mind and you're willing to wait.

IOC orders — "Fill what you can right now"

An immediate-or-cancel order uses the same parameters as a limit order but with one key difference: anything that doesn't fill instantly is cancelled and refunded. IOC orders never rest on the book.

Use IOC when you want to grab available liquidity without leaving a resting order behind — similar to a market order, but with a price ceiling for safety.

Trigger orders — "Watch the price for me"

Stop-losses, take-profits, and conditional entries — dormant instructions that activate when the market hits a price threshold. See Trigger Orders for how they work.

The order lifecycle

An order moves through a simple flow:

  Place order


PENDING ──── matches against resting orders ────▶ FILLED
│ ▲
│ │
├── partially fills, then you cancel ──▶ PARTIAL │
│ │
├── you cancel (no fills) ─────────────▶ CANCELLED│
│ │
└── fills down to dust ───── absorbed as fees ────┘

When an order reaches a terminal state (filled, partial, or cancelled), three things happen: it's recorded in your activity history, it's removed from your active orders, and any remaining locked input is released back to your trading balance.

Dust handling: If an order's remaining input is tiny — below the cost of a ledger transfer — the protocol absorbs it as fees and marks the order filled rather than leaving an economically unviable resting order on the book.

Updating and cancelling orders

You can modify a resting order's price or size. If you're just reducing the size at the same tick, the update happens in-place and you keep your queue position — important if you've been waiting in line. Any other change (moving to a different tick, increasing size) cancels the original and creates a new order at the back of the queue.

Batch operations let you cancel and place orders atomically. The create_orders endpoint accepts cancellations, pool swaps, and book orders in a single call — cancels execute first (freeing balance and order slots), then pool swaps, then book orders. One operation fee covers the entire batch.

There's also a kill switch: cancel_all_orders wipes every resting order in one call, refunding all locked input to your trading balance.


The order book doesn't operate in isolation — every trade can split across the book and AMM pools in a single execution. See Smart Routing for how this works.

For exact API signatures, parameter types, and endpoint details, see the Spot API reference.