Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
eb12a75
feat: add CliCommand block with syntax highlighting and multi-example…
huacnlee Mar 27, 2026
8883beb
Update history-candlestick.md
huacnlee Mar 27, 2026
53c00b6
Update history-candlestick.md
huacnlee Mar 27, 2026
3f2c5d4
Update candlestick.md
huacnlee Mar 27, 2026
b7505ad
Update history-candlestick.md
huacnlee Mar 27, 2026
5c15ebe
Update candlestick.md
huacnlee Mar 27, 2026
0772964
Update history-candlestick.md
huacnlee Mar 27, 2026
e08e16e
Update docs/zh-CN/docs/quote/pull/candlestick.md
huacnlee Mar 27, 2026
4f3d105
Update docs/zh-HK/docs/quote/pull/history-candlestick.md
huacnlee Mar 27, 2026
130d3a1
Update docs/zh-HK/docs/quote/pull/history-candlestick.md
huacnlee Mar 27, 2026
a439354
Update docs/zh-HK/docs/quote/pull/candlestick.md
huacnlee Mar 27, 2026
f8333e6
Update docs/zh-HK/docs/quote/pull/candlestick.md
huacnlee Mar 27, 2026
fc8db4f
Update docs/zh-HK/docs/quote/pull/candlestick.md
huacnlee Mar 27, 2026
5187f9e
fix: replace <order_id> placeholder with numeric ID in CliCommand blocks
huacnlee Mar 27, 2026
ce0488c
docs: add comment before order ID in CliCommand blocks explaining pla…
huacnlee Mar 27, 2026
7194f82
docs: move inline comments to preceding lines in all CliCommand blocks
huacnlee Mar 27, 2026
7adae84
docs: rewrite CLAUDE.md with content architecture and submodule guidance
huacnlee Mar 27, 2026
4ac5d50
Add submodules.
huacnlee Mar 27, 2026
581301a
.
huacnlee Mar 27, 2026
bc946ab
docs: update CONTRIBUTING with submodule sync rules and cross-repo wo…
huacnlee Mar 27, 2026
9eb5f55
.
huacnlee Mar 27, 2026
2637be1
docs: add local dev setup with submodule init to README
huacnlee Mar 27, 2026
9757917
docs: add table of contents to README
huacnlee Mar 27, 2026
253ea32
docs: add repository structure overview to README
huacnlee Mar 27, 2026
20c1747
.
huacnlee Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "openapi"]
path = openapi
url = https://github.com/longbridge/openapi
[submodule "openapi-go"]
path = openapi-go
url = https://github.com/longbridge/openapi-go
[submodule "longbridge-terminal"]
path = longbridge-terminal
url = https://github.com/longbridge/longbridge-terminal
172 changes: 91 additions & 81 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,115 +11,125 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Commands

```bash
# 开发(连接 canary 环境 API)
bun run dev
bun run dev # 开发(canary 环境 API)
bun run dev:prod # 开发(生产环境 API)
bun run build:canary # 构建 canary 环境
bun run build:release # 构建生产环境
bun run build:llms # 构建 llms.txt(在 build 之后执行)
bun run preview # 预览构建产物
```

# 开发(连接生产环境 API)
bun run dev:prod
无测试命令。

# 构建
bun run build:canary # canary 环境
bun run build:release # 生产环境
## 内容架构

# 构建 llms.txt(在 build 之后单独执行)
bun run build:llms
本站分两类内容,定位不同:

# 预览构建产物
bun run preview
```
### Docs(`docs/{lang}/docs/`)

无测试命令,不需要跑测试。
面向**业务场景**的使用指引。内容包括:

## 架构概览
- 入门指南、认证流程
- CLI 命令使用示例(用 `<CliCommand>` 块)
- SDK 调用示例(Python / Rust / Go / Node.js / Java / C++)
- 功能介绍(行情、交易、账户、MCP、AI Skill 等)

这是一个基于 **VitePress 2.0 alpha** 的多语言文档网站,面向 Longbridge 开发者平台(open.longbridge.com)
Docs 页面以 en 为主,zh-CN / zh-HK 为翻译版本,三者内容保持一致

### 目录结构
### API Reference(`docs/{lang}/api/`)

```
docs/
├── .vitepress/
│ ├── config.mts # VitePress 主配置(含路由重写、HTML 注入)
│ ├── config/
│ │ ├── locales.ts # 三语言 locale 聚合(en / zh-CN / zh-HK)
│ │ └── markdown.ts # Markdown 插件注册
│ ├── locales/ # 每个语言的 nav / sidebar / search 配置
│ │ ├── en/
│ │ ├── zh-CN/
│ │ └── zh-HK/
│ ├── theme/
│ │ ├── index.ts # 主题入口,注册全局组件和 vue-i18n
│ │ ├── components/ # Vue 组件(全局注册,可直接在 md 中使用)
│ │ ├── composables/ # Vue composables
│ │ ├── locales/ # i18n 翻译文件(en.json / zh-CN.json / zh-HK.json)
│ │ └── utils/
│ │ └── gen.ts # 自动从文件系统生成 sidebar 的核心逻辑
│ ├── md-plugins/ # 自定义 Markdown-it 插件
│ └── utils.ts # 路由重写逻辑(处理 slug 和语言前缀)
├── en/ # 英文文档内容
├── zh-CN/ # 简体中文文档内容
└── zh-HK/ # 繁体中文文档内容
scripts/ # 构建脚本(generate-llms.ts、normalize_md.ts 等)
```
面向 **HTTP/WebSocket API** 的技术参考。以 `openapi.yaml` 为准:

### 多语言路由
- 参数名称、类型、Required 字段必须与 `openapi.yaml` 完全一致
- 响应结构、错误码以规范为准,不得自行发明
- 更新 API 文档时,先改 `openapi.yaml`,再同步各语言页面

- **英文**为 root locale(`/docs/...`),文件在 `docs/en/`
- **简中**路径为 `/zh-CN/docs/...`,文件在 `docs/zh-CN/`
- **繁中**路径为 `/zh-HK/docs/...`,文件在 `docs/zh-HK/`
- 路由重写由 `docs/.vitepress/utils.ts` 的 `rewriteMarkdownPath` 处理:支持 frontmatter `slug` 字段做绝对/相对路径覆盖
## 三语言规则

### Sidebar 自动生成
每个 `.md` 页面必须在三个语言目录下都有对应文件:

Sidebar 通过 `docs/.vitepress/theme/utils/gen.ts` 的 `genMarkdowDocs(lang, basePath)` 自动从文件系统读取生成,无需手动维护。控制方式:
- `docs/en/` — 英文(root locale,URL 为 `/docs/...`)
- `docs/zh-CN/` — 简体中文(URL 为 `/zh-CN/docs/...`)
- `docs/zh-HK/` — 繁体中文(URL 为 `/zh-HK/docs/...`)

- **排序**:frontmatter `sidebar_position` 字段(数字越小越靠前)
- **分类标题**:子目录下的 `_category_.json`(`label`、`position`、`collapsed` 等)
- **自定义链接**:frontmatter `slug` 字段
- **侧边栏图标**:frontmatter `sidebar_icon` 字段(支持 `book`、`zap`、`cpu`、`terminal`、`sparkles`)
**以 en 为主**,zh-CN / zh-HK 跟随 en 的结构和内容。新增或修改页面时,三个目录必须同步。

### 新增页面流程
### Frontmatter

每个 `.md` 文件需要在三个语言目录下各有一份(`en/`、`zh-CN/`、`zh-HK/`)。如果只在某个 locale 的 nav 中显示,需要同步修改对应的 `docs/.vitepress/locales/{lang}/nav.ts`。
```yaml
---
title: 'Page Title'
id: category_filename # 例:quote_pull-static
slug: '/quote/pull/static' # 以 / 开头,对应 URL 路径
sidebar_position: 3 # 数字越小越靠前
sidebar_icon: book # 可选:book | zap | cpu | terminal | sparkles
---
```

### 全局 Vue 组件
## Skills

在 `docs/.vitepress/theme/components/index.ts` 中导出的组件会全局注册,可直接在 Markdown 中以标签形式使用:
`skills/longbridge/` 存放 AI Agent 的 Skill 文件。Skill 文件保持高层级描述,命令 flag 和输出细节参考 CLI 的 `--help`,不要复制 help 文本进 Skill。

- `<Tabs>` / `<TabItem>` — 代码分组标签页
- `<TipContainer>` — 提示框
- `<TryIt>` — API 在线调试
- `<SDKLinks>` / `<SDK>` — SDK 展示
- `<Skill>` — Skills 展示页
- `<HomePage>` — 首页
## 关联子模块

新增组件需要在 `index.ts` 中 export。
本项目通过 submodule 统一管理以下仓库,修改文档时需同步检查:

### 私有配套仓库
| 仓库 | 用途 | 同步时机 |
| -------------------------------- | --------------------------------- | ------------------------- |
| `longbridge/openapi` | OpenAPI 规范源(`openapi/` 目录) | API 参数/响应变更时 |
| `longbridge/openapi-go` | Go SDK | API 方法签名/参数名变更时 |
| `longbridge/longbridge-terminal` | CLI 二进制 | CLI 命令/flag 变更时 |

`../openapi-website-private`(相对本项目)是配套私有仓库,存放不公开的功能实现(如开发者中心)。涉及相关改动时需检查两个仓库是否需要同步
`openapi.yaml`(根目录)是 API Reference 的权威来源,`openapi/` 目录下是各模块的分片 YAML

### Skills
## CliCommand 块

`skills/` contains AI agent skill files. Currently includes skills for the Longbridge terminal:
在 Docs 中展示 CLI 命令使用 `<CliCommand>` 标签,由 `docs/.vitepress/md-plugins/cli-command.ts` 渲染:

```markdown
<CliCommand>
# 注释说明写在命令前面
longbridge quote TSLA.US
# 可以有多个示例
longbridge quote AAPL.US NVDA.US
</CliCommand>
```
skills/
└── longbridge/
├── SKILL.md # skill entry point — tool selection and quick reference
└── references/
├── cli/overview.md # CLI usage overview (features, extended hours, etc.)
├── python-sdk/ # Python SDK reference
├── rust-sdk/ # Rust SDK reference
├── llm.md # LLM/AI integration
└── mcp.md # MCP setup

规则:

- 注释行(`# ...`)放在对应命令**前面**,不用行尾注释
- 每个 CliCommand 提供 2–4 个示例,使用真实 symbol(优先美股)
- 命令需实际验证正确后再写入文档(交易类命令除外)
- 尖括号占位符(如 `<order_id>`)会被 Vue 解析为 HTML tag 导致构建失败,改用数字示例 + 注释说明

## Sidebar 自动生成

由 `docs/.vitepress/theme/utils/gen.ts` 的 `genMarkdowDocs()` 从文件系统自动生成,无需手动维护。子目录需有 `_category_.json`:

```json
{ "position": 1, "label": "Market Data", "collapsed": false }
```

**Documentation update rules:**
## 全局 Vue 组件

在 `docs/.vitepress/theme/components/index.ts` 中导出的组件可直接在 Markdown 中使用:

| 组件 | 用途 |
| ---------------------- | ------------------------------ |
| `<Tabs>` / `<TabItem>` | 代码分组标签页 |
| `<TipContainer>` | 提示框 |
| `<TryIt>` | API 在线调试 |
| `<SDKLinks>` / `<SDK>` | SDK 链接展示 |
| `<CliCommand>` | CLI 命令块(带高亮和安装引导) |
| `<Skill>` | AI Skill 展示页 |
| `<HomePage>` | 首页 |

新增组件需在 `index.ts` 中 export。

## 路由重写

- All CLI docs, SDK references, and skill files for the Longbridge terminal (`../longbridge-terminal`) are maintained here in `skills/longbridge/` — `../longbridge-terminal` no longer has its own `skills/` directory.
- Skill files should stay high-level. For command flags and output details, defer to the CLI's built-in `--help` — do not copy help text into skill files.
`docs/.vitepress/utils.ts` 的 `rewriteMarkdownPath` 处理 URL 生成。`slug` frontmatter 覆盖默认路径:绝对 slug(`/foo`)替换整个路径;相对 slug 相对文件目录解析。

### 图片/静态资源
## 静态资源

静态资源必须上传 CDN 后引用 URL,不要放进项目中
所有图片/静态文件必须上传 CDN 后引用 URL,不得放入仓库
73 changes: 62 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ This is the source for **https://open.longbridge.com** — the official Longbrid
│ ├── en/ # English content
│ ├── zh-CN/ # Simplified Chinese content
│ └── zh-HK/ # Traditional Chinese content
├── openapi/ # Submodule: github.com/longbridge/openapi
├── openapi-go/ # Submodule: github.com/longbridge/openapi-go
├── longbridge-terminal/ # Submodule: github.com/longbridge/longbridge-terminal
├── skills/
│ └── longbridge/
│ └── SKILL.md # The AI Skill for Longbridge APIs
├── scripts/ # Build scripts
│ ├── generate-llms.ts # Generates llms.txt
│ └── normalize_md.ts # Normalizes Markdown formatting
├── openapi/ # OpenAPI specifications (YAML)
├── CONTRIBUTING.md # This file
└── package.json
```
Expand Down Expand Up @@ -212,21 +214,69 @@ The `docs/.vitepress/utils.ts` `rewriteMarkdownPath` function handles URL genera

---

## Related Repositories
## Submodules

When making changes that affect the API surface, check whether these related repositories need corresponding updates:
This repo includes three submodules for unified cross-repo development. Always `cd` into the submodule directory to make changes there — commits must be made inside the submodule, then the parent repo updated to reference the new commit.

### [`longbridge/openapi`](https://github.com/longbridge/openapi)
```bash
# Initialize after cloning
git submodule update --init --recursive

# Update all submodules to latest
git submodule update --remote --merge
```

### [`openapi/`](https://github.com/longbridge/openapi) — OpenAPI & SDK source

Contains the canonical OpenAPI specification and multi-language SDK source code (Python, Rust, Go, Node.js, Java, C++).

**Sync when:**
- An API endpoint is added, removed, or its parameters/response shape changes
- A new SDK language is added
- An existing SDK method is renamed or its signature changes

**What to change:**
- `openapi/openapi.yaml` — the authoritative API spec; all other changes derive from this
- SDK source files for any affected method across all languages

### [`openapi-go/`](https://github.com/longbridge/openapi-go) — Go SDK

The official Go SDK. Method names, parameter types, and response structs must stay consistent with what is documented in `docs/{lang}/` and defined in `openapi/openapi.yaml`.

**Sync when:**
- An API method signature changes (parameter added/removed/renamed)
- A new endpoint is added that needs a Go implementation
- Response struct fields change

**What to change:**
- Go struct definitions and method signatures in `openapi-go/`
- Ensure Go method names in `SDKLinks` component (`docs/.vitepress/theme/components/SDKLinks.vue`) match

### [`longbridge-terminal/`](https://github.com/longbridge/longbridge-terminal) — CLI binary

The `longbridge` CLI distributed via Homebrew. CLI docs (`docs/{lang}/docs/cli.md`) and `<CliCommand>` examples in API docs must reflect the actual CLI behavior.

The canonical OpenAPI specification source. The `openapi/` directory in this repo may mirror or derive from it. If the API schema changes, both repos may need updating.
**Sync when:**
- A new CLI command or flag is added
- A command's output format or behavior changes
- A command is deprecated or removed

### [`longbridge/openapi-go`](https://github.com/longbridge/openapi-go)
**What to change:**
- CLI source in `longbridge-terminal/`
- `docs/{lang}/docs/cli.md` in all three locales
- Any `<CliCommand>` blocks in docs that use the affected command
- `skills/longbridge/references/cli/overview.md`

The official Go SDK. Reflects the same API surface documented here. If you update API docs, check whether the Go SDK's method signatures, parameter names, or response types are consistent with what's documented.
### Cross-repo change workflow

### [`longbridge/longbridge-terminal`](https://github.com/longbridge/longbridge-terminal)
When a change touches multiple repos (e.g., a new API endpoint):

The `longbridge` CLI binary (distributed via Homebrew). CLI reference docs at `docs/{lang}/cli.md` must accurately reflect the CLI's actual commands and flags. When documenting CLI features, verify against the terminal repo.
1. Update `openapi/openapi.yaml` (API spec)
2. Update SDK implementations in `openapi/` and `openapi-go/` as needed
3. Update CLI in `longbridge-terminal/` if a new command is needed
4. Update `docs/{lang}/` pages (all three locales) with new `<CliCommand>` examples and SDK request examples
5. Update `skills/longbridge/SKILL.md` if the AI Skill needs to know about the new endpoint
6. Commit each submodule separately, then update the parent repo's submodule reference

---

Expand Down Expand Up @@ -262,6 +312,7 @@ Before submitting a PR, verify:
- [ ] Frontmatter is present and correct (`title`, `id`, `slug`, `sidebar_position`)
- [ ] No images or static assets added to the repo (use CDN URLs)
- [ ] If a new component was added, it is exported from `theme/components/index.ts`
- [ ] If the API surface changed, `openapi/` YAML and the AI Skill (`skills/longbridge/SKILL.md`) are updated
- [ ] Related repositories are checked for consistency
- [ ] If the API surface changed: `openapi/openapi.yaml`, SDK source in `openapi/` and `openapi-go/`, and `skills/longbridge/SKILL.md` are updated
- [ ] If CLI commands changed: `longbridge-terminal/` source, `docs/{lang}/docs/cli.md`, and affected `<CliCommand>` blocks are updated
- [ ] Submodule commits are made inside the submodule directory; parent repo references the new commit
- [ ] Markdown formatting is clean (run `autocorrect --fix .` for Chinese/English spacing)
Loading
Loading