This page will help you get started with "orders" channel

Channel: orders

Before subscribing to this channel, authentication is required.

The orders channel provides updates on all orders across all markets. Upon subscription, you receive one snapshot of the orders. Afterward, real-time updates are streamed to you whenever there are changes to your orders.

The update response includes an extra field called last_trades, which shows the trades in the most recent events:

  • The snapshot response doesn't include this field because it's not about the latest event.
  • If an order is canceled, the update response doesn't include this field since cancellation events don't involve trades.
  • If an order is fully filled, the response includes this field because trades occurred, completing the order.
// Request
{
  "op": "sub",
  "channel": "orders"
}
// Response - SNAPSHOT
// the order's format should be the same with the REST api about order
{
   "channel":"orders",
   "type":"snapshot",
   "data":[
      {
         "avg_price":"46485.3",
         "cancel_reason":"",
         "cancel_reject_reason":"",
         "cancel_requested":false,
         "created_at":"2024-01-10T18:08:15.344842Z",
         "filled_fees":"2.11043262",
         "filled_size":"0.227",
         "id":"c13a321a-569a-4a6b-a3e8-edc272c3897c",
         "is_liquidation":false,
         "nonce":"1048684939130209705251083977639453724597727385951185282177916",
         "post_only":false,
         "price":"46485.3",
         "product_id":"BTC-PERP",
         "reject_reason":"",
         "sender":"0x9c1ac03164c39b47ebceb3b7212ca35159f0841e",
         "side":"BUY",
         "signing_time":"1704910094129000000",
         "size":"0.235",
         "status":"OPEN",
         "time_in_force":"GTC",
         "type":"LIMIT"
      },
      {
         "avg_price":"0",
         "cancel_reason":"",
         "cancel_reject_reason":"",
         "cancel_requested":false,
         "created_at":"2024-01-10T18:08:15.336054Z",
         "filled_fees":"0",
         "filled_size":"0",
         "id":"73409348-cf5b-43a9-9f07-ce0b6c7b57ec",
         "is_liquidation":false,
         "nonce":"1217627006710145786420390238151789672100558897676788586036695",
         "post_only":false,
         "price":"46491.8",
         "product_id":"BTC-PERP",
         "reject_reason":"",
         "sender":"0x9c1ac03164c39b47ebceb3b7212ca35159f0841e",
         "side":"SELL",
         "signing_time":"1704910094227000000",
         "size":"0.374",
         "status":"OPEN",
         "time_in_force":"GTC",
         "type":"LIMIT"
      }
   ]
}
// Response - update
// the API format is the same with the snapshot. In each update, the server might returns multiple changed orders
{
   "channel":"orders",
   "type":"update",
   "data":[
      {
         "avg_price":"2376.99",
         "cancel_reason":"",
         "cancel_reject_reason":"",
         "cancel_requested":false,
         "created_at":"2024-02-07T16:13:41.200799Z",
         "filled_fees":"0.93891105",
         "filled_size":"0.79",
         "id":"133fb19d-b585-4ad9-8194-a4e585399018",
         "initial_margin":"187.886226206932671",
         "is_liquidation":false,
         "last_trades":[
            {
               "funding_payment":"0",
               "id":"0x252532a2130941448827a6575a1f9878133fb19db5854ad98194a4e585399018",
               "liquidity_indicator":"TAKER",
               "price":"2376.99",
               "sequencer_fee":"0",
               "size":"0.79",
               "time":"1707322421211343000",
               "trading_fee":"0.93891105"
            }
         ],
         "nonce":"1707322420828700200",
         "post_only":false,
         "price":"2353.22",
         "product_id":"ETH-PERP",
         "reduce_only":true,
         "reject_reason":"",
         "sender":"0xa01f2319baf9e8a344486ebafa96fb3c9f5bda05",
         "side":"SELL",
         "size":"0.79",
         "status":"DONE",
         "time_in_force":"FOK",
         "type":"MARKET"
      }
   ]
}

πŸ“˜

Orders

Check out Get an order response for the order struct returned from this endpoint and Matching Engine for what various order statuses mean.