DEV Community

Anna Botsford
Anna Botsford

Posted on

cowswap Explained: Swap, Limit, and TWAP Orders

cowswap is a DEX aggregator for trading tokens from your own wallet. For a token exchange, cowswap sends your signed trade intent into CoW Protocol’s batch auctions, where solvers compete to execute it using available liquidity while reducing exposure to MEV. The main choices are a swap, a limit order, and a TWAP order.

cowswap settles trades through batch auctions

A signed order enters a batch auction before any tokens change hands. On a centralised exchange, you deposit assets and trade against its order book; here, the tokens remain in your wallet until settlement. Your order states what you will sell, what you want to receive, and the worst exchange rate you will accept.

Solvers compete to find a way to fill orders in the batch. They can match opposing orders directly—a Coincidence of Wants—or route trades through liquidity on decentralised exchanges. A winning solver submits the settlement transaction, provided the result meets each order’s signed conditions.

Before batching, say a 10 ETH sale goes straight to a liquidity pool and moves its price. After batching, if another trader wants to buy 10 ETH, a solver may match the two orders without putting that full trade through the pool; if there is no match, it can seek an external route. Batch settlement also reduces the opportunity for a bot to place trades immediately before and after yours, the MEV tactic called a sandwich attack.

Swap, limit, and TWAP orders serve different purposes

A swap seeks a trade soon, a limit order waits for your price, and a time-weighted average price (TWAP) order spreads a larger trade across scheduled parts. CoW Swap uses the same solver auction model for these order types, but each gives the solver different conditions to meet.

  • Swap — best for trading at the available price: You specify a sell amount or desired buy amount and accept a quoted rate within a slippage limit. It suits a trade you want completed soon. It does not fit when you need a particular future price; a quote can expire or go unfilled if conditions change.
  • Limit order — best for a price target: You set the minimum you will receive when selling, or the maximum you will pay when buying, and an expiry. Say you would sell 1 ETH only for at least 3,200 USDC: the order waits if execution cannot meet that rate. It does not fit when completion matters more than price, and briefly touching your limit does not guarantee a fill once execution costs are accounted for.
  • TWAP order — best for reducing the price impact of a large trade: It divides an amount into scheduled smaller orders; for example, 12 ETH could become six 2 ETH parts an hour apart. It does not fit when you need the entire amount traded at once, and later parts face whatever market prices prevail then. Check wallet compatibility before planning one, because conditional TWAP orders can require a compatible smart-contract wallet.

The deciding factor is what you can leave uncertain. A swap leaves the final rate within your stated bounds, a limit order leaves the fill time uncertain, and a TWAP leaves later execution prices uncertain. None promises that an order will fill.

The amount received includes execution costs

The useful comparison is the net amount received, after the route’s price impact and applicable execution costs. A solver pays to settle a batch on-chain and accounts for that cost in its offer; a trade may also incur a protocol fee. Those amounts vary with the route, network conditions, and order, so an attractive headline exchange rate can still produce a smaller net return.

Signing an order is generally an off-chain action, but allowing a settlement contract to spend a token may require an on-chain approval and its own gas payment. Check the token, spender, and approval amount in your wallet before authorising it. For a limit order, keep enough of the sell token available while it remains open; spending it elsewhere can prevent settlement.

A wallet trade starts with its conditions

To trade from your wallet, first confirm that you hold the intended token on the intended network and verify the token’s contract address if its name is ambiguous. Choose the order type by deciding whether your priority is prompt execution, a minimum price, or spreading a large trade over time. Then compare the expected net receipt with the minimum you are willing to accept.

Review the signed amount, receiving token, price protection, and expiry before authorising an order. After signing, watch for a fill or expiry rather than treating submission as a completed trade; a limit order may fill in parts. CoW Swap’s auction mechanism can find a route and reduce sandwich exposure, while your order conditions determine which result you have agreed to accept.

Top comments (0)