> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.6mm.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.6mm.com/_mcp/server.

# 6MM CLI

6MM CLI 是面向用户、脚本和能够执行 shell 命令的 AI Agent 的命令行入口。

当 AI 环境可以直接运行终端命令时，CLI 通常是最简单的接入方式，因为它不需要额外运行 MCP 服务。CLI 默认应返回稳定 JSON，方便 Agent 解析结果，而不是依赖终端展示格式。

<h2 id="what-the-cli-is-good-for">
  CLI 适合做什么
</h2>

* 在终端里快速查询市场数据。
* 在 Codex、Claude Code、Gemini CLI 等工具中进行 Agent 驱动分析。
* 在 CI 或定时脚本中读取 6MM 数据。
* 在本地配置凭证后执行账户只读检查。
* 让 Agent 准备订单参数并执行订单预览，但不直接下单。

<h2 id="example-commands">
  命令示例
</h2>

```bash
6mm markets
6mm ticker BTC-USDT-PERP
6mm orderbook BTC-USDT-PERP --depth 20
6mm klines BTC-USDT-PERP --interval 1h --limit 100
6mm account summary
6mm positions
6mm orders open
6mm order preview --symbol BTC-USDT-PERP --side buy --type limit --price 65000 --size 0.01
6mm order create --symbol BTC-USDT-PERP --side buy --type limit --price 65000 --size 0.01
6mm order cancel --order-id xxx
```

<h2 id="output-modes">
  输出模式
</h2>

| 模式    | 使用场景                 |
| ----- | -------------------- |
| JSON  | AI Agent、脚本和自动化默认使用。 |
| Table | 人类在终端中查看。            |
| Raw   | 调试和集成测试。             |

<h2 id="recommended-safety-defaults">
  推荐安全默认值
</h2>

* 默认环境为测试网。
* 默认输出为 JSON。
* 交易命令必须显式开启。
* Mainnet 下单必须确认。
* 创建订单前提供预览模式。
* 错误返回包含稳定错误码和清晰描述。

<h2 id="agent-usage">
  Agent 使用方式
</h2>

除非用户明确要求预览或交易动作，AI Agent 应优先使用只读命令。

示例提示词：

```text
使用 6MM CLI 查询 BTC-USDT-PERP 的盘口深度，并输出简短流动性总结。
```