Order Types
Understanding CoW Protocol order kinds and execution modesOverview
CoW Protocol supports different order types to accommodate various trading strategies. Understanding these types is essential for building effective trading applications.Order Kind
Every order has akind that determines whether you’re specifying the exact sell or buy amount:
SELL Orders
A sell order specifies the exact amount of tokens you want to sell.sellAmountis the exact amount you’re sellingbuyAmountis the minimum amount you’ll accept- The actual execution may give you more than
buyAmount(positive slippage)
BUY Orders
A buy order specifies the exact amount of tokens you want to receive.buyAmountis the exact amount you’re buyingsellAmountis the maximum amount you’ll spend- The actual execution may cost less than
sellAmount(positive slippage)
Execution Modes
Orders can be configured as either fill-or-kill or partially fillable:Fill-or-Kill Orders
A fill-or-kill order must be executed entirely in a single settlement or not at all.- You need the entire order executed atomically
- Trading smaller amounts where partial fills aren’t practical
- You want predictable, all-or-nothing execution
Partially Fillable Orders
A partially fillable order can be executed across multiple settlements until the full amount is filled or the order expires.- Trading large amounts that might be hard to fill at once
- You want to capture liquidity as it becomes available
- Building limit orders that execute over time
Swap Orders vs Limit Orders
Swap Orders (Market Orders)
Swap orders execute immediately at the best available price with slippage protection.- Execute at current market conditions
- Have slippage tolerance (e.g., 0.5%)
- Typically fill-or-kill
- Short validity period (e.g., 20 minutes)
- Class:
"market"
Limit Orders
Limit orders execute only when your specified price is met or exceeded.- Execute at your specified limit price or better
- No slippage tolerance
- Can be partially fillable
- Longer validity period (hours to days)
- Class:
"limit"
Order Parameters
All orders share these core parameters:Token Balance Sources
Orders can interact with different token balance sources:ERC20 Balance (Default)
Balancer Vault Balances
For advanced use cases with Balancer Vault integration:Most applications use the default
ERC20 balance mode. Balancer Vault integration is for advanced scenarios.Order Lifecycle
1
Order Creation
Create and sign an order with your desired parameters
2
Order Submission
Submit the signed order to the CoW Protocol API
3
Order Discovery
Solvers discover your order and compete to find the best execution
4
Order Execution
The winning solver executes your order on-chain in a batch settlement
5
Order Completion
Tokens are transferred and the order is marked as filled
Practical Examples
Best Practices
Use SELL for Market Orders
Most users know how much they want to sell. Use
OrderKind.SELL for simpler UX.Set Reasonable Validity
Market orders: 10-30 minutes. Limit orders: hours to days based on volatility.
Partial Fills for Large Orders
Enable
partiallyFillable: true for large orders to improve fill rates.Monitor Order Status
Poll the OrderBook API to track order status and fills over time.
Next Steps
Signing Schemes
Learn how orders are signed
App Data
Add metadata to your orders
Trading SDK
Start building with the SDK