What Is an Order?
An order represents your intent to buy or sell a specific quantity of a base asset (e.g., BTC) using a quote asset (e.g., USD) on a given product (e.g.,BTC-USD). Orders are matched against the exchange’s order book. Depending on the order type and current market conditions, an order may fill immediately, partially, remain open, or fail entirely.
Every order has:
- A side — whether you are buying or selling
- A type — the execution strategy (market, limit, stop-limit)
- A status — the current state of the order
- A product — the trading pair the order applies to
Order Types
Coinbase Advanced Trade supports three primary order types:MARKET
A market order executes immediately at the best available price in the order book. You specify only the quantity (or the total spend amount), and the exchange fills your order at whatever price the market offers at that moment.LIMIT
A limit order lets you set a maximum price you are willing to pay (for a buy) or a minimum price you are willing to accept (for a sell). The order will only fill at your specified price or better. If the market does not reach your price, the order remains open until it fills, is cancelled, or expires. Limit orders give you price certainty at the cost of execution certainty — your order may never fill if the market moves away from your price.STOP_LIMIT
A stop-limit order combines a stop trigger with a limit order. You define two prices:- Stop price — The price at which the order is activated and submitted to the order book
- Limit price — The price at or better than which the activated order will fill
A stop-limit order is not active on the order book until the stop price is triggered. Before the stop is reached, the order will appear with a pending or open status but will not participate in matching.
Order Sides
Every order must specify a side:Order Statuses
As an order moves through the exchange, it transitions through a series of statuses:status
The order has been accepted and is active on the order book. It has not yet been fully filled and is awaiting matching.
status
The order has been completely executed. The full requested quantity has been matched and the trade has settled.
status
The order was cancelled before it could be fully filled. This may be the result of a manual cancellation, a time-in-force expiry, or an IOC/FOK condition that could not be met.
status
The order reached its expiration time (set via
end_time for GTD orders) without being filled and was automatically removed from the order book.status
The order could not be placed. This can occur due to insufficient funds, invalid parameters, or exchange-side rejections.
Time in Force
Time-in-force (TIF) options control how long an order remains active if it is not immediately filled. The available options are:Order Lifecycle
Understanding how an order moves from submission to settlement helps you design robust error handling and state management in your application.-
Submission — You send a
POSTrequest to create an order. The API validates your parameters (sufficient balance, valid product, correct size precision) and returns anorder_id. -
Acceptance — If validation passes, the order enters the
OPENstate and is placed on the order book (for limit orders) or routed for immediate matching (for market orders). - Matching — The exchange’s matching engine continuously pairs buy and sell orders. A limit order fills when a counterparty order crosses your price. A market order fills against existing liquidity immediately.
-
Partial Fill — An order may fill in multiple smaller trades (called fills) over time. The
filled_sizeandfilled_valuefields update as each partial fill occurs. The order remainsOPENuntil fully filled. -
Resolution — The order reaches a terminal state:
FILLED(fully executed),CANCELLED(manually or by TIF policy), orEXPIRED(GTD time elapsed). -
Settlement — Once filled, your account balances update. The acquired asset appears in
available_balance, and any held funds for the order are released.
The
order_id returned by the API is Coinbase’s internal identifier for the order. You may also supply your own client_order_id at creation time for idempotency and easier reconciliation on your end. These are two separate identifiers — use order_id when querying or cancelling orders via the API.Key Order Fields
string
required
The unique identifier assigned by Coinbase when the order is created. Use this to query, cancel, or reference the order in subsequent API calls.
string
An optional identifier you supply at creation time. Useful for idempotency checks and for correlating API orders with your internal records.
string
required
The trading pair for the order (e.g.,
"BTC-USD").string
required
Whether the order is a
BUY or SELL.string
required
The order strategy:
MARKET, LIMIT, or STOP_LIMIT.string
The current state of the order:
OPEN, FILLED, CANCELLED, EXPIRED, or FAILED.string
The quantity of the base asset that has been filled so far, as a string.
string
The total quote asset value of all fills so far, as a string.
string
The average price per unit across all fills, as a string. Empty until at least one fill has occurred.
string
ISO 8601 timestamp of when the order was created.
Example Order Object
The following is an example of a filled limit buy order for 0.01 BTC on theBTC-USD product:
65500.00 but filled at the better price of 65400.00, resulting in a total fill value of 654.00 USD.