> 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/exchange/zh-cn/overview/architecture.md).

# 架构

交易所由哪些组件构成，以及目前运行的部分。

Nexus Exchange 是一个**配备原生撮合引擎、风险系统和预言机的中央限价订单簿**。订单挂在订单簿中，按价格-时间优先原则撮合，并以交易所持有的保证金结算。它的运作方式与中心化衍生品交易所相同，而不同于 AMM 或意图撮合协议。

订单簿、撮合、保证金和强平逻辑是**交易所引擎的原生组成部分**，而不是部署在链上的智能合约。这一设计使交易所能够以 CEX 级别的确认延迟为目标，交易者和应用通过同一个 API 即可使用全部功能。

## 组件

四个组件承担全部工作。每个组件负责一项职责，并在本部分中拥有各自的页面。

```mermaid
flowchart LR
  C[Clients — traders, market makers] --> API[API<br/>REST + WebSocket]
  API --> ME[Matching Engine<br/>order books, matching, fills]
  API --> RE[Risk Engine<br/>margin, liquidations, funding]
  ME <--> RE
  OR[Oracle<br/>mark and index prices] --> RE
  OR --> ME
```

| 组件       | 负责内容                                                  | 文档位置                                                                                                                                                                                                  |
| -------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **API**  | 所有进出通道：下单、撤单、修改订单、账户和市场查询、WebSocket 数据流。它本身不保存任何交易状态。 | [API 与速率限制](/exchange/zh-cn/apis-and-rates/apis-and-rates.md)、[API 参考](https://docs.nexus.xyz/api-reference)                                                                                          |
| **撮合引擎** | 订单簿、价格-时间撮合，以及由此产生的成交。                                | [订单类型](/exchange/zh-cn/trading/trading/perpetuals/order-types.md)、[价格发现边界](/exchange/zh-cn/trading/trading/perpetuals/discovery-bounds.md)                                                            |
| **风险引擎** | 保证金、强平、自动减仓、资金费和保险基金。                                 | [保证金机制](/exchange/zh-cn/trading/trading/perpetuals/margining.md)、[强平](/exchange/zh-cn/trading/trading/perpetuals/liquidations.md)、[资金费率](/exchange/zh-cn/trading/trading/perpetuals/funding-rates.md) |
| **预言机**  | 指数价格和标记价格，保证金、资金费和强平均以其为基准计算。                         | [价格预言机](/exchange/zh-cn/trading/trading/perpetuals/price-oracles.md)                                                                                                                                  |

这一设计的两个特性可以解释交易者会看到的行为。

**撮合引擎与风险引擎双向通信**。风险引擎不仅观察订单簿，还会对其采取行动。当账户跌破维持保证金，或预言机价格变动触发了某个条件时，风险引擎会提交平仓订单并撤销挂单。因此，您的账户上可能出现并非由您提交的成交。请参阅[强平](/exchange/zh-cn/trading/trading/perpetuals/liquidations.md)。

**预言机更新不只是写入一个价格**。它会推动标记价格变动，从而触发条件单并驱动强平扫描。因此，即使没有任何新订单进入，一个平静的市场也可能出现一连串已触发的订单和强平。

## 目前运行的部分

|           |                                                |
| --------- | ---------------------------------------------- |
| 撮合、保证金、强平 | 在交易所引擎中                                        |
| 抵押品       | 测试网上的合成 USDX，由水龙头发放。真实 USDX 计划通过以太坊上的充值跨链桥进出   |
| 市场        | 永续合约，以 USDX 计价并作为保证金。已上线的市场以 `GET /markets` 为准 |

**您目前交易的交易所就是这个引擎**。上述组件是它的组成部分，[速率与连接限制](/exchange/zh-cn/apis-and-rates/apis-and-rates/rate-limits.md)列出了限制集成的各项数值。

除此之外的任何内容都属于路线图，而非对交易所的描述。请参阅[路线图](https://docs.nexus.xyz/exchange-layer-1/overview/roadmap)。本页的任何内容均不构成对日期的承诺。


---

# 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/exchange/zh-cn/overview/architecture.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.
