> For the complete documentation index, see [llms.txt](https://puregamma-ai.gitbook.io/puregamma-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://puregamma-ai.gitbook.io/puregamma-ai/gong-neng-zhi-nan/hui-ce-shi-yan-shi.md).

# 回测实验室

> 位置:左侧栏「研究」组 → 回测。这是平台的隐藏能力:把「聊出来的想法」变成「可验证的策略」。

回测实验室根据你与秘书、Agent 的对话内容与记忆,由 LLM 按 NautilusTrader 契约生成**日频交易策略规范**,再在统一下载的真实历史数据上回测,输出完整绩效。

## 工作流程

```
对话/记忆 → LLM 生成策略 spec(pydantic 强校验) → 日频引擎回测 → 绩效报告
```

1. **数据**:BTC / ETH 日线,来自 Binance 公开 klines,三年历史,全平台共享一份数据集,每日凌晨自动增量更新。
2. **策略生成**:输入你的想法(如「动量突破 + 均值回归混合」),可选择是否引用对话记忆;生成的 spec JSON 可手动编辑后再跑。
3. **回测引擎**:支持日频策略(动量 / 均值回归 / 突破)与截面多空策略(相对强弱、长短腿、定期再平衡);建模手续费、止损、换手与次日开盘价成交,杜绝未来函数。
4. **绩效展示**:累计收益、年化、夏普、最大回撤、胜率、换手、暴露度、尾部损失,净值曲线 + 分资产明细 + 假设披露。

## 使用步骤

1. 打开「回测」页,确认数据覆盖条(BTC/ETH 覆盖范围与最新日期)。
2. 输入策略想法,勾选「引用对话记忆」(可选),生成策略 spec。
3. 检查/编辑 spec JSON,选择回测窗口。
4. 运行,查看绩效网格与净值曲线;历史运行记录在下方列表。

## 限制

* 每用户每日 5 次运行(服务器为 4C8G,单次回测约 2200 根日线,毫秒级完成)。
* 仅支持 BTC / ETH 日线与日频/截面多空模板;更复杂的策略请使用 Agent 讨论后细化。
* 回测结果是历史模拟,不代表未来表现;交易成本与滑点均为简化模型。

## 与平台的联动

* `deep_research` 技能会引导 Agent 在讨论策略类问题时调用回测验证;
* 秘书与 Agent 的记忆是策略生成的上下文来源;
* 回测消耗 Credits,按任务计费(见 订阅与 Credits)。


---

# 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://puregamma-ai.gitbook.io/puregamma-ai/gong-neng-zhi-nan/hui-ce-shi-yan-shi.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.
