Learn · Orders

How do limit orders work on a DEX?

A limit order lets you set the price you are willing to trade at and have the trade execute only when the market reaches it, instead of swapping immediately at the current price. On decentralized exchanges this is implemented differently from a centralized order book, and understanding the mechanics — how the order is stored, who executes it, and what can prevent a fill — helps you use limit orders effectively. This article explains how on-chain limit orders work and how they differ from spot swaps.

Limit orders versus spot swaps

A spot swap executes right now at whatever the pool quotes. A limit order says: only execute if the price reaches my target. That lets you wait for a better entry or exit without watching the market constantly. The trade-off is that a limit order is not guaranteed to fill — if the price never reaches your target, nothing happens, and even when it does, conditions must allow execution.

How a DEX stores the order

Without a central order book, on-chain limit orders are typically represented as a signed instruction or an order placed in a smart contract that authorizes a trade under specific conditions. You sign the order in advance; it sits until the conditions are met. Crucially, you retain custody — the order is a conditional permission, not a deposit of your funds with an exchange.

Who actually executes it

Because smart contracts cannot act on their own, someone has to trigger execution when the price condition is satisfied. This role is usually filled by keepers or solvers — independent actors who monitor orders and execute them when profitable or as a service, earning a small incentive. This is why a limit order can fill slightly after the exact moment your price is touched: it depends on a keeper acting.

What can prevent a fill

Several things can stop a limit order from executing even when the price appears to reach your target. Liquidity may be too thin at that price to fill the size. The price may touch your level only briefly, before a keeper acts. Network congestion or gas conditions can delay execution. And the order parameters — expiry, slippage on execution — affect whether it completes. Limit orders reduce the need to watch the market, but they are best-effort, not guaranteed.

When a limit order is the right tool

Limit orders suit patient, price-specific trades — buying a dip to a level you set in advance, or taking profit at a target without sitting at the screen. They are less suited to fast-moving or thin markets, where a brief price touch can pass before a keeper fills you, or where execution slippage erodes the edge. Match the tool to the market: deep, liquid pairs reward limit orders most, while urgent trades in volatile conditions are usually better served by a spot swap.

Legal

Risk disclosure

XAUConnect is a non-custodial swap aggregator. Digital assets are volatile and may lose value rapidly. Content on this page is educational and not investment advice. Verify every contract address on the official block explorer before approving a transaction.

Frequently asked questions

How is a limit order different from a swap?

A swap executes immediately at the current price; a limit order executes only if the market reaches a price you set, and may never fill if it does not.

Do I give up custody when placing a limit order?

On a non-custodial DEX, no. The order is a signed conditional instruction; your funds stay in your wallet until the conditions are met and it executes.

Who executes my limit order?

Keepers or solvers — independent actors who monitor orders and trigger them when conditions are met, earning a small incentive, since contracts cannot act on their own.

Why might my limit order not fill at my price?

Thin liquidity at that level, a price that only briefly touches your target, congestion, or order parameters like expiry can all prevent execution. Limit orders are best-effort.

Live execution

Trade on XAUConnect

Open the swap page to compare live routes, set slippage, and sign from your own wallet — fully non-custodial.

Continue exploring

Related markets, guides & networks

Curated next steps based on this topic — deepen your research before you trade.

Build programmatically

Swap via API for bots and AI agents — quotes, builds, and cross-chain routes.

Developer quickstart