> For the complete documentation index, see [llms.txt](https://support.backpack.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.backpack.exchange/support-docs/cn/jiao-yi-suo/api-yu-kai-fa-zhe-wen-dang/chang-jian-wen-ti-jie-da.md).

# 常见问题解答

<details>

<summary>Backpack 支持哪些 API？</summary>

Backpack 提供两种集成方式，取决于您需要的是请求/响应操作还是实时数据流。

#### REST API

使用 REST API 进行按需操作，例如获取市场/账户数据以及管理订单。

常用端点包括：

* GET /markets
* GET /balances
* POST /orders
* DELETE /orders

#### WebSocket API

使用 WebSocket API 获取低延迟的实时数据流。

常见使用场景包括：

* 订阅订单簿更新
* 订阅 K 线（candlestick）数据流
* 订阅已验证账户事件（例如订单和持仓更新）

</details>

<details>

<summary>API 是否可用于合约交易？</summary>

可以。Backpack 通过相同的订单和账户端点支持现货交易和永续合约交易。\
要交易永续合约，请使用永续市场符号。

示例：\
POST /orders - SOL\_USDC\_PERP

</details>

<details>

<summary>我可以使用 API 提现资产吗？</summary>

可以，但启用提现功能需要严格的安全控制（包括双重验证）。

要配置带有强制 2FA 的提现地址，请使用：\
<https://backpack.exchange/settings/withdrawal-addresses?twoFactorWithdrawalAddress=true>

双重验证参数(<https://docs.backpack.exchange/#tag/Capital/operation/request\\_withdrawal:\\~:text=asset%20to%20withdraw.-,twoFactorToken,-string)目前已被禁用。>

</details>

<details>

<summary>API 速率限制是什么？每个服务器或子账户是否不同？</summary>

速率限制是按子账户计算的，而不是按服务器。\
默认情况下，每个子账户每分钟最多可发出 2000 次标准 REST 端点请求。

历史市场数据端点的限制为每个子账户每分钟 30 次请求。\
（“历史端点”指返回时间区间数据的 REST 路由，例如蜡烛图或成交记录。）

如果达到限制，系统将返回 HTTP 429 响应。\
建议在处理高频市场数据时使用 WebSocket 数据流。

</details>

<details>

<summary>下单时常见错误有哪些</summary>

| 错误代码                         | 描述                 | 解决方案                                                          |
| ---------------------------- | ------------------ | ------------------------------------------------------------- |
| **INVALID\_CLIENT\_REQUEST** | 签名无效               | 请检查查询字符串的构建方法（排序、参数值等）。同时确认布尔值是否为小写形式，例如应使用 “true” 而非 “True”。 |
| **INVALID\_CLIENT\_REQUEST** | 请求已过期              | 请求到达交易所服务器的时间超过了 X-Window 和 window 的设定值。尝试增加时间窗口。             |
| **INVALID\_CLIENT\_REQUEST** | 数量小数位过长            | 将数量调整为符合 stepSize（最小变动单位）。                                    |
| **INVALID\_CLIENT\_REQUEST** | 无效的 X-Signature 头部 | 查询字符串使用了错误的密钥对进行签名。请确认您使用的是 ED25519。                          |
| **429**                      | 请求过多               | 减少请求频率；建议使用 WebSocket 流方式进行数据传输。                              |

</details>

<details>

<summary>我在哪里可以找到 SDK？</summary>

官方 SDK 目前仅提供 Rust 版本：<https://github.com/backpack-exchange/bpx-api-client>\
\
您还可以参考以下页面，查看由社区维护的多语言示例：\
<https://support.backpack.exchange/exchange/api-and-developer-docs/api-clients>

</details>

<details>

<summary>我如何获取某个交易对的实时市场数据？</summary>

使用 **WebSocket 流** 来获取实时市场更新：

[Book Ticker](https://docs.backpack.exchange/#tag/Streams/Public/Book-ticker) (bookTicker.\<symbol>)\
实时提供最佳买卖价及挂单数量，适合用于盘口顶部显示。

[Depth](https://docs.backpack.exchange/#tag/Streams/Public/Depth) (depth.\<symbol>)\
增量订单簿更新。首先通过 REST 获取初始快照，然后从流中应用深度增量更新。\
深度数据可选择实时或聚合模式（例如 200ms / 600ms / 1000ms）以减少流量。\
\
查看完整的流列表：[https://docs.backpack.exchange/#tag/Streams](https://docs.backpack.exchange/#tag/Streamshttps://docs.backpack.exchange/#tag/Streams)

</details>

<details>

<summary>我如何提高交易机器人的稳定性？</summary>

推荐的最佳实践：

* 优先使用 WebSocket 订阅来接收实时订单/交易更新，而不是频繁轮询 REST。
* 对 REST 请求和 WebSocket 连接实现重试机制与指数退避（exponential backoff）。
* 本地缓存常用的参考数据（如市场、交易对、过滤参数等），并定期刷新。
* 监控并警报关键 API 错误（如认证失败、请求过期、429 速率限制等）。

</details>


---

# 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://support.backpack.exchange/support-docs/cn/jiao-yi-suo/api-yu-kai-fa-zhe-wen-dang/chang-jian-wen-ti-jie-da.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.
