> ## 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.

# 账户活动

> 查询当前认证账户的事件合约持仓、成交和相关账户活动。

> [!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)。

事件合约 API 提供当前认证账户的持仓和成交记录。相关接口属于私有接口，需要完成认证后调用。

生产环境 Base URL：

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

## 查询持仓

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

常见返回字段包括：`position_id`、`event_id`、`token_id`、`outcome`、`size`、`available_size`、`locked_size`、`avg_open_price`、`position_value`、`settlement_status`、`won` 和 `updated_at`。

## 查询已结算持仓

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

该接口返回已结算的事件合约持仓。

## 查询个人成交

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

个人成交记录通常包含 `trade_id`、`order_id`、`condition_id`、`token_id`、`price`、`size`、`side`、`role` 和 `fee_rate` 等字段。

> [!NOTE]
>
> 账户类接口用于查询当前认证用户的数据，不建议将其理解为任意钱包地址的公开链上查询接口。


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