value), and we work out the size, send the order, and report what filled.
Order types
Both types are immediate or cancel: whatever can fill fills at once, and the rest is canceled. Nothing waits on the order book. Orders that rest on the book, and stop-loss and take-profit orders, are planned but not available yet.
Value and size
You size every order byvalue, in US dollars. We turn it into a size in the asset’s units, such as BTC:
- We work out the price limit. For a market order, it is the current price moved 0.5% against you: above it for a buy, below it for a sell. For a limit order, it is your
price. - We divide your value by the price limit and round down to the market’s
size_increment. A sell is divided by the higher of its price limit and the current price plus 0.5%. - We check the result is worth at least
min_valueand at mostmax_value.
value you sent, even if every unit fills at the limit. So an order usually fills for slightly less than you asked. The difference is the price band and the rounding, never extra fees taken from the value.
Worked example: buying $250 of BTC
Worked example: buying $250 of BTC
BTC is trading at $84,010 and its
size_increment is 0.00001.The order’s
summary explains the difference: “You asked for 84,430.”Rounding rules
- A size calculated from your value is always rounded down. We never place a bigger order than you asked for.
- A limit
priceyou send is rounded to the market’s price precision in your favour: a buy limit down, a sell limit up. The order returns the price it used, with aprice_roundednote. - An order worth less than $10 after rounding is refused before anything is recorded. The error tells you the smallest value that passes.
Statuses
Placing an order waits for the result, for up to 5 seconds, so the response is almost always final. If it is still
pending, read it again with GET /v1/orders/{id} after a second or two. Set the wait yourself with the Prefer header: Prefer: wait=0 returns at once, and Prefer: wait=15 waits up to 15 seconds.
More statuses will be added when orders can rest on the book. Treat a status you don’t recognise as not final.
Why an order was canceled or rejected
status_reason explains every canceled and rejected order with a code and a sentence that includes the numbers involved.
A rejected order never traded. Placing it again needs a new
client_order_id, because the old one names the rejected order.
Sides, positions and flips
Orders have aside: buy or sell. Positions have a direction: long or short. You hold at most one position per market, and every order moves it:
- A buy adds to a long, or reduces a short.
- A sell adds to a short, or reduces a long.
- An order bigger than the opposite position closes it and opens the other side with the rest. That is a flip.
position_effect on the order says which happened: open, increase, reduce, close or flip. A flip also adds a position_flipped note.
Reduce-only orders
Setreduce_only: true to make sure an order can only shrink a position. It never opens one and never flips. If you have no position, or the order is in the same direction as your position, it is refused before anything is recorded. If it is bigger than the position, it closes the position and stops.
To close a position, you can also use POST /v1/positions/{symbol}/close, which works out the side and size for you.
Reading an order
- What you asked for:
market,side,type,requested_value(orrequested_percentfor a close),price,reduce_only,metadata. - How we read it:
sizeandprice_limit. - What happened:
status,status_reason,filled_size,average_fill_price,filled_value,fee,position_effect.
fee can arrive a few seconds after the order finishes. It is the total you paid, including the exchange’s fee and ours.
Summary, notes and timeline
summarysays what happened in one to three sentences, including anything surprising. It is written for people and language models. Don’t parse it: the fields hold the same facts, and the wording may change.notespoint out things that did not stop the order but are worth knowing, each with acodeand amessage:size_rounded,price_rounded,position_flippedandposition_closed. A preview can also haveavailable_low,partial_fill_likelyandtrading_approval_expiring.timelineis the order’s history, one entry per step. Addexpand[]=timelinewhen you read the order:
Metadata
metadata holds up to 20 string values of your own. We store them with the order and return them unchanged, and never act on them. It is a good place to record why an order was placed:
Client order IDs
Every order needs aclient_order_id that you choose: 1 to 64 letters, digits, ., _, : or -. It is unique across your account forever, and it makes retries safe. Sending the same request with the same ID never places a second order. See Retries and idempotency.