Orders

Get all open orders associated with a subaccount.

Rate limits

  • 1200 requests/min or 20 requests/sec per IP address. (weight = 2) or 2 * length of product_ids for multi-product orders query.

See more details in API Rate limits

Single Product

Request

Connect

WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]

Message

{
  "type": "subaccount_orders",
  "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
  "product_id": 1
}

Request Parameters

Parameter
Type
Required
Description

sender

string

Yes

A bytes32 sent as a hex string; includes the address and the subaccount identifier.

product_id

number

Yes

Id of spot / perp product for which to retrieve subaccount orders.

Response

{
  "status": "success",
  "data": {
    "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
    "product_id": 1,
    "orders": [
      {
        "product_id": 1,
        "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
        "price_x18": "1000000000000000000",
        "amount": "1000000000000000000",
        "expiration": "2000000000",
        "nonce": "1",
        "order_type": "default",
        "unfilled_amount": "1000000000000000000",
        "digest": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "placed_at": 1682437739,
        "order_type": "ioc"
      }
    ]
  },
  "request_type": "query_subaccount_orders"
}

Note: that side of the order (buy/sell) is included in the sign of amount and unfilled_amount . They are positive if the order is a buy order, otherwise negative.

Multiple Products

Request

Connect

WEBSOCKET [CORE_WEBSOCKET_ENDPOINT]

Message

{
  "type": "orders",
  "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
  "product_ids": [1, 2, 3]
}

Request Parameters

Parameter
Type
Required
Description

sender

string

Yes

A bytes32 sent as a hex string; includes the address and the subaccount identifier.

product_ids

number[]

Yes

List of spot / perp products for which to retrieve open orders.

Response

{
  "status": "success",
  "data": {
    "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
    "product_orders": [
      {
        "product_id": 1,
        "orders": [
           {
            "product_id": 1,
            "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
            "price_x18": "1000000000000000000",
            "amount": "1000000000000000000",
            "expiration": "2000000000",
            "nonce": "1",
            "order_type": "default",
            "unfilled_amount": "1000000000000000000",
            "digest": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "placed_at": 1682437739,
            "order_type": "ioc"
          }
        ]
      },
      {
        "product_id": 2,
        "orders": []
      }
    ]
  },
  "request_type": "query_orders"
}

Last updated