Trade
Orders

Trading

Orders

Market and limit orders, time in force, reduce-only, the ack and cancels.

An order names a market, a side (buy or sell), a size in the base asset and a kind. The session key signs it and the engine answers on the same WebSocket with an ack or a reject.

Market orders

A market order takes no price. It fills against the resting orders on the other side of the book, best price first, as far as 5% from the mark. Whatever hasn't filled by then is cancelled, and the ack says how much filled. A market order that fills nothing is rejected.

Limit orders

A limit order fills at its price or better. Its time in force decides what happens to the part that doesn't fill at once:

Time in forceThe unfilled part
gtcRests on the book at the limit price until it fills or you cancel it. The default.
iocIs cancelled. The order fills what it can on arrival and nothing rests.
post_onlyRests in full. If any of the order would fill on arrival, the order is rejected instead, so a post-only order only ever fills as maker.

A limit price has to be a whole number of the market's ticks, and a size a whole number of its lots and at least its minimum size (Markets).

Reduce-only

A reduce-only order can only make your position in that market smaller. One that would open a position or add to it is rejected. Closing from the positions table sends a reduce-only market order for the whole position, or for the size you enter.

Leverage

Leverage is set per market, from 1x to 20x, and applies to every order and the position in that market. It sets the initial margin an order needs: notional divided by leverage.

The ack

The ack says whether the order rests, filled in part or filled in full, lists each fill with its price, size and fee, and gives the average fill price. It also carries two figures from the engine:

  • the arrival price: the best price on the other side of the book when the order arrived, which is the price your screen showed at the click;
  • the ack time: how long the engine took from receiving the order to sending the ack, in microseconds.

The trade screen shows an order as pending only if the ack takes longer than 50 ms.

Your own orders

An order never fills against a resting order from the same account. When it would, the engine cancels the resting order and the incoming order carries on down the book.

When a market halts

While a market has no fresh index, the engine accepts only reduce-only orders and cancels in it.

Cancel

You can cancel one resting order or all of them, in one market or in every market. A cancel is acked with the ids of the orders it removed.

Order states

StateMeaning
restingOn the book, nothing filled.
partially_filledSome of the size filled and the rest is on the book.
filledThe whole size filled.
cancelledOff the book with the rest unfilled, by your cancel or by its time in force.