> For the complete documentation index, see [llms.txt](https://docs.nexus.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexus.xyz/api-reference/zh-cn/guides/statistics.md).

# 交易所统计数据

**本页介绍生成的参考页面无法涵盖的内容**。这三个操作各有一个根据契约渲染的独立页面。本页介绍它们的共同点：为什么它们是公开的、这些数字代表什么，以及三处看似合理却错误的理解。

交易所的汇总遥测数据：累计成交量、持仓量以及账户余额分布。**三个操作，全部公开**。它们声明了 `security: []`，因此无需 API 密钥。

这些是全交易所范围的数字。单个账户的状态位于参考侧边栏中的 Account 页面和 Positions 页面。

## 按设计即为汇总数据

本页的每个 Schema 都被记录为**完全不包含任何单账户数据**：*“Aggregate only — it carries no account id, address, or per-account volume by construction.”*（仅为汇总数据：按设计，它不包含账户 ID、地址或单账户成交量。）这是契约自身的措辞，也是这些端点公开、而 Account 下的所有端点都不公开的原因。

如果您在构建公开仪表盘、行情数据页面，或需要交易所背景信息的代理，**请使用这些端点**。不要通过逐个读取单账户数据来推算交易所汇总数据。

## 本页内容

| 操作                                                                                 | 路径                                | 返回内容                    |
| ---------------------------------------------------------------------------------- | --------------------------------- | ----------------------- |
| [累计成交量](https://docs.nexus.xyz/api-reference/statistics/fetch-cumulative-volume)   | `GET /stats/volume`               | 累计成交名义价值，包括全交易所总计和各市场数值 |
| [持仓量](https://docs.nexus.xyz/api-reference/statistics/fetch-open-interest)         | `GET /stats/open-interest`        | 持仓量，多头和空头分别报告           |
| [余额分布](https://docs.nexus.xyz/api-reference/statistics/fetch-balance-distribution) | `GET /stats/balance-distribution` | 各余额区间的账户数量              |

**另有两个 `/stats` 操作记录在其他位置。** `GET /stats`（交易所快照）和 `GET /stats/history`（吞吐量采样）在契约中标记为 `Markets`，并在 [`GET /stats`](https://docs.nexus.xyz/api-reference/markets/fetch-stats) 中介绍。这五个操作全部公开。

这里的三个操作都没有 `/api/v1` 对应版本。它们仅为网关路径。

## 测试网数据仅作示例，契约在响应中明确说明了这一点

三个响应都带有两个字段，您应当展示它们，而不是将其去除：

| 字段        | 含义                            |
| --------- | ----------------------------- |
| `testnet` | 布尔值，目前**始终为 `true`**。数据仅作示例。  |
| `note`    | 一段供人阅读的免责说明，包括关于持仓量单边与总额区别的警告 |

**服务重启时，数字也会重新开始计算**，因为这些是索引器本地的投影，而非全时段账本。成交量响应中的 `coverage_start_ms` 表明总计数值能追溯到多久以前。

## 小数以字符串表示

每个名义价值数字都是以字符串序列化的无损小数（[`Decimal`](https://docs.nexus.xyz/api-reference/guides/schemas#decimal) Schema）。**请使用小数类型解析，切勿使用浮点数**。`account_count` 和 `count` 是 JSON 整数，时间戳是 Unix 纪元毫秒（[`TimestampMs`](https://docs.nexus.xyz/api-reference/guides/schemas#timestampms)）。

## 两侧从不预先相加，命名方式是有意为之

在为此端点的任何数字添加说明文字之前，请先阅读本节。

* **应当标注的数字是 `long_oi_quote`（或 `short_oi_quote`）。** 在匹配的订单簿上，二者按设计相等。如果持续存在差异，说明投影已与引擎失去同步。
* **`gross_oi_two_sided_quote` 是 `long + short`，** 即单边数字的两倍。它被命名为 `gross` 和 `two_sided`，是为了让任何人都无法把它当作单边总额来展示。
* **全交易所数字仅以计价资产表示**。刻意没有全交易所的基础资产单位总额。基础资产单位无法跨市场相加，因此契约不会发布没有统一单位的数字。

## 相关内容

* [`GET /stats`](https://docs.nexus.xyz/api-reference/markets/fetch-stats)：`GET /stats` 和 `GET /stats/history`，以及各市场摘要和风险参数。
* 参考侧边栏中的 Tickers 页面：各市场24小时滚动价格和成交量统计数据。
* [Schema 参考（英文）](https://docs.nexus.xyz/api-reference/guides/schemas)：组件 Schema 参考。

## 待解决问题

契约中的缺口，在此标出而非自行补全：

* **子对象的区间边界类型未声明 Schema**。`BalanceBucket.min` 和 `max` 带有描述，但在契约中没有声明类型。本页根据“in USDX collateral”（以 USDX 抵押品计）和全页统一的小数约定，将它们记录为小数字符串。
* **`testnet` 的类型为布尔值，但文档写的是“始终为 `true`”。** 对于该值为 `false` 的部署，没有说明相应行为，也没有任何操作会告诉您当前连接的是哪个部署。
* **保留期限未说明**。三个操作都被描述为随服务重启，但契约没有给出保留时间窗口、缓冲区大小或检查点频率。因此契约无法告诉您 `coverage_start_ms` 最远能追溯到多久以前。
* **`quote_error` 的取值未列举。** 文字描述了三种原因（未镜像标记价格、标记价格过期、溢出），但没有规定具体字符串，因此您无法安全地据此进行分支判断。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexus.xyz/api-reference/zh-cn/guides/statistics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
