Skip to main content
Package: monaco.api.orders Source: protos/api/orders.proto Use OrdersService for authenticated order management.

Notes

  • Order creation, cancellation, replacement, and listing require authentication.
  • Batch RPCs are the preferred path for multi-order workflows.
  • BatchCancelAll and BatchCancelAllByPair return UNAVAILABLE with the code OVERLOADED when the exchange refuses the call before admission: nothing is cancelled, so back off and retry. Any other UNAVAILABLE (a transient matching-engine or transport failure) can arrive after the cancel ran, so read your open orders before acting on it.
  • CancelAllAfter arms, refreshes or disarms a dead man’s switch. timeout_ms is 0 to disarm, otherwise 5000–900000; set trading_pair_id to scope the timer to one pair (the account-wide timer and each pair’s timer are separate). Unless you call again before the deadline, resting limit orders, triggered TP/SL legs resting on the book and TWAP parents that are not reduce-only are cancelled with terminal reason CANCEL_ALL_AFTER, and your RFQ quotes standing since before the deadline in RFQs still collecting quotes are withdrawn by the RFQ service shortly after. A timer that fires is spent. A bad timeout or pair is INVALID_ARGUMENT; a delegated session without trading_pair_id or cancel permission on that pair is PERMISSION_DENIED; each call costs one risk-reduction rate-limit item (RESOURCE_EXHAUSTED over it); UNAVAILABLE with error code OVERLOADED means nothing changed, and any other UNAVAILABLE has an unknown outcome. The call is safe to retry. See Cancel All After.
  • Attach TP/SL through order placement or PositionsService.AttachPositionTpSl.
  • GetConditionalOrder fetches a single TP/SL order by UUID — the same IDs returned as take_profit_order_id and stop_loss_order_id in CreateOrderResponse.
  • A trigger and the order it fires into are linked in both directions, and both reads are owner-scoped. GetConditionalOrder and ListConditionalOrders carry triggered_order — the close’s current status, filled quantity, average fill price, taker fees, fill time and terminal reason, read from that order at request time — present only once state is TRIGGERED and the close can be read, never on a FAILED conditional, and never on the conditional_orders WebSocket frames. GetOrder / ListOrders carry the reverse pointer conditional_order_id on a close the engine placed for a trigger; it is absent on client-placed orders, on TWAP children (they carry parent_order_id), and on closes older than the field, which are not backfilled.
  • ListOrders returns book orders only (LIMIT and MARKET): TWAP parents and conditional (TP/SL) orders are not rows of it under any status or trading_mode filter and are not counted in total; list them with ListTwapOrders and ListConditionalOrders. A TWAP’s slices — the child orders it places, which carry parent_order_id — are not rows of it either, resting or finished, and are not counted: read them with ListTwapOrderSlices. The close a trigger fired into is a book order and is listed as its own row carrying conditional_order_id.
  • ReplaceOrder and BatchReplaceOrders carry an entry order’s pending take-profit and stop-loss legs onto the replacement and re-check them as placement would: a fixed trigger on the wrong side of the replacement’s expected entry fails a single ReplaceOrder with INVALID_ARGUMENT, and in BatchReplaceOrders the RPC returns OK with that item’s results[].error.code set to INVALID_ORDER; either way the original keeps resting. A replacement that fills on arrival arms the carried legs — a fixed TP/SL on any fill, a trailing stop on a full fill.
  • ReplaceOrder and BatchReplaceOrders refuse to replace the LIMIT leg a TP/SL fired into — an order carrying conditional_order_id — the way a passive TWAP child is refused: a replacement rests under a new order id the conditional does not point at, which would sever the link both ways. The refusal names the conditional order and the original leg stays resting; in a batch the refused item’s original is never cancelled. Cancelling a triggered leg is unchanged.
  • TWAP parent orders execute a large order as scheduled market child orders across a time window. CreateTwapOrder, CancelTwapOrder, GetTwapOrder, and ListTwapOrders manage the parent lifecycle; GetTwapOrder returns the TwapOrder read model directly. Delegated-agent sessions are rejected for all TWAP RPCs. See TWAP Orders for the execution model.
  • GetTwapOrderTca returns the post-execution transaction cost analysis report for a terminal TWAP parent (COMPLETED or CANCELLED). A non-terminal parent is INVALID_ARGUMENT; another user’s parent is NOT_FOUND, indistinguishable from an unknown ID. The six analytics fields are optional and absent when they cannot be computed honestly.
  • ListTwapOrderSlices lists one TWAP parent’s child orders (its slices), each a GetOrderResponse exactly as GetOrder returns it with parent_order_id set to the parent, resting and finished alike. order_by is ASC (the default, oldest slice first) or DESC by created_at; page_size is 1-1000 (default 20) and next_page_token is minted only while a further page exists, pinned to the parent and order_by that minted it. A PASSIVE parent’s reprices and deadline sweeps are child orders too, so a parent can have more slices than slices_placed. Another user’s parent is NOT_FOUND, indistinguishable from an unknown ID.