> ## Documentation Index
> Fetch the complete documentation index at: https://dexbuilder.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 管理订单

> 通过 Event Contracts API 查询和取消事件合约私有订单。

> [!NOTE]
>
> 以下私有接口示例使用 Broker API Key。每次请求都需携带 `KEY`、`Timestamp`、`SIGN` 和 `X-User-Wallet-Address`；签名使用实际外部请求路径、Query String 和 Body。 [Broker API 认证与签名](https://dexbuilder.mintlify.site/zh/event-contracts/api/broker-authentication.md)。

订单查询与撤单都属于私有操作，需要认证。生产环境 Base URL：

```text theme={null}
https://api.dexbuilder.com
```

## 查询订单列表

```bash cURL theme={null}
curl -G "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${WALLET}" \
  --data-urlencode "status=open" \
  --data-urlencode "condition_id=<condition_id>" \
  --data-urlencode "limit=20"
```

常用筛选参数包括：`status`、`condition_id`、`event_id`、`order_id`、`client_order_id`、`from`、`to`、`sort_type`、`limit` 与 `cursor`。

`from`、`to` 使用 Unix 毫秒；`sort_type` 可按 `created_at` 或 `updated_at` 排序。

响应：

```json theme={null}
{
  "items": [
    {
      "order_id": "order-123",
      "client_order_id": "client-order-001",
      "event_id": "event-123",
      "condition_id": "0xabc...",
      "token_id": "token-yes",
      "outcome": "Yes",
      "side": "BUY",
      "price": "0.52",
      "size": "10",
      "size_matched": "4",
      "size_left": "6",
      "order_type": "GTC",
      "order_mode": "LIMIT",
      "status": "open",
      "created_at": 1782753357,
      "updated_at": 1782753357
    }
  ],
  "next_cursor": "eyJvZmZzZXQiOjIwfQ"
}
```

将 `next_cursor` 原样作为下一页请求的 `cursor`。

## 查询单个订单

```bash cURL theme={null}
curl "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders/<order_id>" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${WALLET}"
```

详情响应包含列表中的订单标识、价格、数量、成交进度与状态等字段，并可能包含订单服务返回的 `error_code`。

## 取消单个订单

```bash cURL theme={null}
curl -X DELETE "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders/<order_id>" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${WALLET}"
```

```json theme={null}
{
  "order_id": "order-123",
  "status": "processing",
  "cancel_status": "accepted"
}
```

## 按 Condition 取消订单

```bash cURL theme={null}
curl -X DELETE "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders?condition_id=<condition_id>" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${WALLET}"
```

```json theme={null}
{
  "batch_id": "batch-123",
  "status": "accepted",
  "total_orders": 3
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.