Orderbook

private/batch_order

Changed on

Places, replaces and cancels orders for one subaccount in a single request. orders holds post-only limit orders and cancels holds open orders to cancel, each by order_id and instrument_name; together they hold 1 to 1000 items. Each order is a signed private/order payload; an order that also sets order_id_to_cancel or nonce_to_cancel replaces that open order, which must be on the same instrument. Every order must use the batch subaccount_id, the same signer, time_in_force post_only and order_type limit, with no trigger or algo fields, reduce_only or is_atomic_signing. The batch is checked as a whole first, including margin for all of its orders together; open orders that it cancels or replaces do not count. If a check fails, no order is placed or cancelled, and the error data names the failing order as index=<n> or the failing cancel as cancel index=<n>. A batch of cancels alone has no margin check. Otherwise, on each instrument the cancels apply before the orders. Returns one result per order with its nonce, order_id, status (open, rejected with its error, or pending if it had no result yet), final limit_price and cancelled_order_id, and one result per cancel with its order_id and status (cancelled, rejected with its error, or pending). A cancel of an order that is not open on the named instrument is rejected and does not affect the rest of the batch. A replace cancels its old order even when the new order is then rejected. A batch costs 50 matching rate-limit points, whatever its size. A batch refused for lack of points costs nothing. Requires Orderbook trade scope for the instrument of every order; a batch of cancels alone requires any trade scope.

post/private/batch_order

Request

  • Base URL
    https://api.derive.xyz/v3
  • Auth
    API key in header X-DeriveWallet and API key in header X-DeriveTimestamp and API key in header X-DeriveSignature

Request body

BatchOrderRequest required

private/batch_order params.

cancels, BatchCancelRequest[]

Open orders to cancel. orders and cancels hold 1 to 1000 items in total.

orders, ReplaceOrderRequest[]

Post-only limit orders, all with the same signer. An order with order_id_to_cancel or nonce_to_cancel replaces that order.

subaccount_id, integer required

Response

Success

BatchOrderResponse required
cancels, BatchCancelResult[] required
orders, BatchOrderResult[] required

Changes