Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion docs/en/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ sidebar_position: 7
sidebar_icon: newspaper
---

## 2026-07-20

- **US accounts can sign in to Longbridge Developers** — US accounts are now supported for login and API access. Note that the mainland-China `.cn` domains (`openapi.longbridge.cn`, `openapi-quote.longbridge.cn`, `openapi-trade.longbridge.cn`) do not serve US accounts; use the default domains instead
- **Longbridge MCP supports US accounts** — US accounts can complete OAuth authorization on `https://mcp.longbridge.com` and requests route to the US data center; the `https://mcp.longbridge.cn` endpoint serves AP accounts only

### CLI v0.25.0

- **US data center is live** — US accounts can log in through `auth login` (device flow or `--auth-code`), and requests route to the data center matching the token; `auth status` reports the active DC region
- **US market coverage** — 14 account and fundamentals commands (`positions`, `order`, `company`, `valuation`, `financial-report`, `consensus`, `dividend`, etc.) transparently route to US-specific endpoints for US tokens, with new `profit-analysis realized` and `financial-report key-metrics` subcommands
- **Navi scripting on the quant platform** — `quant run` now targets the v2 API and supports Navi alongside PineScript via `--language navi|pine` (Navi is the default)

## 2026-07-07

### SDK v4.4.0
Expand All @@ -20,7 +31,6 @@ sidebar_icon: newspaper
- **New `profit-analysis realized` subcommand** — realized P&L breakdown by asset category for US accounts (stock/option/crypto)
- **New `order --status` / `--action` flags** — filter US order history by status and side
- **New `order detail --attached` flag** — show attached child order for US accounts

## 2026-06-25

### SDK v4.3.3
Expand Down
5 changes: 4 additions & 1 deletion docs/en/docs/cli/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ sidebar_icon: newspaper

### [v0.25.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.25.0)

- **US data-center support** — `auth login` (device flow and `--auth-code`) can now authorize US accounts, and every authenticated request routes to the data center matching the token; `auth status` shows the active DC region
- **US account and fundamentals coverage** — US tokens automatically route 14 commands (`positions`, `order`, `company`, `valuation`, `financial-report`, `financial-statement`, `consensus`, `dividend`, etc.) to US-specific endpoints, plus new `profit-analysis realized` and `financial-report key-metrics` subcommands
- **`quant run` moved to the v2 API with Navi support** — new `--language navi|pine` flag (Navi is the default); chart rendering handles both the v1 and v2 payload shapes

- **US market routing** — `company`, `valuation`, `financial-report`, `consensus`, `dividend`, `order`, `positions` auto-route to US APIs for US data-center accounts
- **New `etf-docs` command** — list ETF regulatory documents (prospectus, fact sheets, annual reports) for US ETFs; `--limit` controls how many to return
- **New `financial-report key-metrics` subcommand** — key financial indicators for US stocks; supports `--report annual|quarterly`
- **New `profit-analysis realized` subcommand** — realized P&L by asset category (`--category stock|option|crypto`); US accounts only
- **New order flags** — `--status pending|history|all` and `--action buy|sell` filter US order history; `order detail --attached` fetches child orders

### [v0.24.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.24.0)

- **New `macrodata` command** — Browse 400+ macrodata indicators across US/HK/CN/EU/JP/SG; list mode with optional `--country` filter, history mode for a specific indicator code with `--start`/`--end` date range; `--format json` for AI/scripting workflows
Expand Down
36 changes: 26 additions & 10 deletions docs/en/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ For access in mainland China, you can use `.cn` domains for better connectivity:
The SDK automatically selects the access point by network. If the SDK selects incorrectly, set the environment variable `LONGBRIDGE_REGION` (e.g. `cn` or `hk`).
:::

### Access Points and Data Centers

Two concepts that are easy to confuse:

- **Access point** (`.com` / `.cn`) — network routing only. Both serve identical data and identical auth: a token issued through one is accepted by the other.
- **Data center** (`ap` / `us`) — where the account itself lives. It determines which US-only APIs are available.

The two cannot be combined freely:

| Data center | `.com` | `.cn` |
| ------------------------- | ---------------------------------- | ------------- |
| `us` (US accounts) | Yes — the only usable access point | Not supported |
| `ap` (Longbridge SG / HK) | Yes | Yes |

`.cn` has no route to the US data center, so US accounts must always use the `.com` domains — including for login, since the `.cn` login page does not offer US accounts.

## Time Format

All API response are used [Unix Timestamp](https://en.wikipedia.org/wiki/Unix_time), timezone is UTC.
Expand Down Expand Up @@ -417,17 +433,17 @@ Please pay attention to protect your **Access Token** information, anyone who ge

**Other environment variables:**

| Name | Description |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `LONGBRIDGE_LANGUAGE` | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
| `LONGBRIDGE_HTTP_URL` | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
| `LONGBRIDGE_QUOTE_WS_URL` | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
| `LONGBRIDGE_TRADE_WS_URL` | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
| `LONGBRIDGE_REGION` | Override API region; SDK auto-selects by network. Set to `cn` or `hk` if incorrect. |
| Name | Description |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `LONGBRIDGE_LANGUAGE` | Language identifier, `zh-CN`, `zh-HK` or `en` (Default: `en`) |
| `LONGBRIDGE_HTTP_URL` | HTTP endpoint url (Default: `https://openapi.longbridge.com`) |
| `LONGBRIDGE_QUOTE_WS_URL` | Quote websocket endpoint url (Default: `wss://openapi-quote.longbridge.com/v2`) |
| `LONGBRIDGE_TRADE_WS_URL` | Trade websocket endpoint url (Default: `wss://openapi-trade.longbridge.com/v2`) |
| `LONGBRIDGE_REGION` | Override API region; SDK auto-selects by network. Set to `cn` or `hk` if incorrect. |
| `LONGBRIDGE_ENABLE_OVERNIGHT` | Enable overnight quote, `true` or `false` (Default: `false`). Overnight quotes are included free in US LV1. US stocks only. |
| `LONGBRIDGE_PUSH_CANDLESTICK_MODE` | `realtime` or `confirmed` (Default: `realtime`) |
| `LONGBRIDGE_PRINT_QUOTE_PACKAGES` | Print quote packages when connected, `true` or `false` (Default: `true`) |
| `LONGBRIDGE_LOG_PATH` | Set the path of the log files (Default: no logs) |
| `LONGBRIDGE_PUSH_CANDLESTICK_MODE` | `realtime` or `confirmed` (Default: `realtime`) |
| `LONGBRIDGE_PRINT_QUOTE_PACKAGES` | Print quote packages when connected, `true` or `false` (Default: `true`) |
| `LONGBRIDGE_LOG_PATH` | Set the path of the log files (Default: no logs) |

:::info
The SDK also accepts the legacy `LONGPORT_*` variable names for backward compatibility.
Expand Down
4 changes: 3 additions & 1 deletion docs/en/docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Longbridge provides a hosted MCP (Model Context Protocol) service that lets you

- Global: `https://mcp.longbridge.com`
- Mainland China: `https://mcp.longbridge.cn` (faster access)
:::

US accounts must use the global endpoint — `.cn` has no route to the US data center and serves AP accounts (Longbridge SG / HK) only. See [Access Points and Data Centers](/docs/getting-started#access-points-and-data-centers).
:::

## Available capabilities

Expand Down
12 changes: 11 additions & 1 deletion docs/zh-CN/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ sidebar_position: 7
sidebar_icon: newspaper
---

## 2026-07-20

- **Developers 平台支持美国账户登录** — 美国账户现已支持登录与接口调用。注意国内 `.cn` 域名(`openapi.longbridge.cn`、`openapi-quote.longbridge.cn`、`openapi-trade.longbridge.cn`)不支持美国账户,请使用默认域名
- **Longbridge MCP 支持美国账户** — 美国账户可在 `https://mcp.longbridge.com` 完成 OAuth 授权,请求会路由到美国数据中心;`https://mcp.longbridge.cn` 端点仅服务 AP 账户

### CLI v0.25.0

- **美国数据中心上线** — 美国账户可通过 `auth login`(设备码或 `--auth-code`)登录,请求按 token 自动路由到对应数据中心;`auth status` 展示当前 DC 区域
- **美股市场接口覆盖** — 美股 token 下 14 个账户与基本面命令(`positions`、`order`、`company`、`valuation`、`financial-report`、`consensus`、`dividend` 等)自动路由到美股专属接口,并新增 `profit-analysis realized`、`financial-report key-metrics` 子命令
- **量化平台支持 Navi 脚本** — `quant run` 迁移至 v2 接口,通过 `--language navi|pine` 同时支持 Navi 与 PineScript(默认 Navi)

## 2026-07-07

### SDK v4.4.0
Expand All @@ -20,7 +31,6 @@ sidebar_icon: newspaper
- **新增 `profit-analysis realized` 子命令** — 美股账户按资产类别(股票/期权/加密货币)统计已实现盈亏
- **新增 `order --status` / `--action` 选项** — 筛选美股历史委托状态和方向
- **新增 `order detail --attached` 选项** — 获取美股账户关联子委托

## 2026-06-25

### SDK v4.3.3
Expand Down
5 changes: 4 additions & 1 deletion docs/zh-CN/docs/cli/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ sidebar_icon: newspaper

### [v0.25.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.25.0)

- **支持美国数据中心** — `auth login`(设备码流程与 `--auth-code`)支持美国账户授权,所有请求会按 token 自动路由到对应数据中心;`auth status` 展示当前 DC 区域
- **美股账户与基本面接口覆盖** — 美股 token 下 14 个命令(`positions`、`order`、`company`、`valuation`、`financial-report`、`financial-statement`、`consensus`、`dividend` 等)自动路由到美股专属接口,并新增 `profit-analysis realized`、`financial-report key-metrics` 子命令
- **`quant run` 迁移至 v2 接口并支持 Navi** — 新增 `--language navi|pine` 参数(默认 Navi);图表渲染同时兼容 v1 与 v2 两种数据结构

- **美股账户路由** — `company`、`valuation`、`financial-report`、`consensus`、`dividend`、`order`、`positions` 在美股数据中心账户下自动路由至美股 API
- **新增 `etf-docs` 命令** — 列出美股 ETF 监管文件(招股书、事实说明书、年报),`--limit` 控制返回数量
- **新增 `financial-report key-metrics` 子命令** — 美股关键财务指标,支持 `--report annual|quarterly`
- **新增 `profit-analysis realized` 子命令** — 美股账户已实现盈亏,支持 `--category stock|option|crypto` 筛选
- **新增订单选项** — `--status pending|history|all` 和 `--action buy|sell` 筛选美股历史委托;`order detail --attached` 获取关联子委托

### [v0.24.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.24.0)

- **新增 `macrodata` 命令** — 浏览 400+ 宏观数据指标,覆盖美/港/中/欧/日/新六大市场;列表模式支持 `--country` 筛选,历史模式支持 `--start`/`--end` 日期区间;`--format json` 满足 AI / 脚本需求
Expand Down
16 changes: 16 additions & 0 deletions docs/zh-CN/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ sidebar_icon: zap
SDK 会自动选择接入点;若判断不正确,可设置环境变量 `LONGBRIDGE_REGION`(如 `cn`、`hk`)。
:::

### 接入点与数据中心

两个容易混淆的概念:

- **接入点**(`.com` / `.cn`)— 仅是网络路由。两者数据一致、鉴权一致,一方签发的 token 另一方同样接受。
- **数据中心**(`ap` / `us`)— 账户本身所在的位置,决定了哪些美股专属接口可用。

两者不能自由组合:

| 数据中心 | `.com` | `.cn` |
| --------------------- | -------------------- | ------ |
| `us`(美国账户) | 支持,且是唯一接入点 | 不支持 |
| `ap`(新加坡 / 香港) | 支持 | 支持 |

`.cn` 没有通往美国数据中心的链路,因此美国账户必须始终使用 `.com` 域名,登录同样如此 —— `.cn` 的登录页不提供美国账户选项。

## 时间格式

所有 API 返回有关时间的字段,我们都采用 [Unix Timestamp](https://en.wikipedia.org/wiki/Unix_time) 时区为 UTC。
Expand Down
4 changes: 3 additions & 1 deletion docs/zh-CN/docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Longbridge 提供托管的 MCP(Model Context Protocol)服务,让你在 Cha

- 全球:`https://mcp.longbridge.com`
- 中国大陆:`https://mcp.longbridge.cn`(访问更快)
:::

美国账户请使用全球地址 —— `.cn` 没有通往美国数据中心的链路,仅服务 AP 账户(新加坡 / 香港)。详见[接入点与数据中心](/zh-CN/docs/getting-started#接入点与数据中心)。
:::

## 可用能力

Expand Down
12 changes: 11 additions & 1 deletion docs/zh-HK/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ sidebar_position: 7
sidebar_icon: newspaper
---

## 2026-07-20

- **Developers 平台支援美國賬戶登入** — 美國賬戶現已支援登入與接口調用。注意國內 `.cn` 域名(`openapi.longbridge.cn`、`openapi-quote.longbridge.cn`、`openapi-trade.longbridge.cn`)不支援美國賬戶,請使用預設域名
- **Longbridge MCP 支援美國賬戶** — 美國賬戶可在 `https://mcp.longbridge.com` 完成 OAuth 授權,請求會路由到美國數據中心;`https://mcp.longbridge.cn` 端點僅服務 AP 賬戶

### CLI v0.25.0

- **美國數據中心上線** — 美國賬戶可透過 `auth login`(裝置碼或 `--auth-code`)登入,請求按 token 自動路由到對應數據中心;`auth status` 展示當前 DC 區域
- **美股市場接口覆蓋** — 美股 token 下 14 個賬戶與基本面命令(`positions`、`order`、`company`、`valuation`、`financial-report`、`consensus`、`dividend` 等)自動路由到美股專屬接口,並新增 `profit-analysis realized`、`financial-report key-metrics` 子命令
- **量化平台支援 Navi 腳本** — `quant run` 遷移至 v2 接口,透過 `--language navi|pine` 同時支援 Navi 與 PineScript(預設 Navi)

## 2026-07-07

### SDK v4.4.0
Expand All @@ -20,7 +31,6 @@ sidebar_icon: newspaper
- **新增 `profit-analysis realized` 子命令** — 美股賬戶按資產類別(股票/期權/加密貨幣)統計已實現盈虧
- **新增 `order --status` / `--action` 選項** — 篩選美股歷史委託狀態和方向
- **新增 `order detail --attached` 選項** — 獲取美股賬戶關聯子委託

## 2026-06-25

### SDK v4.3.3
Expand Down
5 changes: 4 additions & 1 deletion docs/zh-HK/docs/cli/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ sidebar_icon: newspaper

### [v0.25.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.25.0)

- **支援美國數據中心** — `auth login`(裝置碼流程與 `--auth-code`)支援美國賬戶授權,所有請求會按 token 自動路由到對應數據中心;`auth status` 展示當前 DC 區域
- **美股賬戶與基本面接口覆蓋** — 美股 token 下 14 個命令(`positions`、`order`、`company`、`valuation`、`financial-report`、`financial-statement`、`consensus`、`dividend` 等)自動路由到美股專屬接口,並新增 `profit-analysis realized`、`financial-report key-metrics` 子命令
- **`quant run` 遷移至 v2 接口並支援 Navi** — 新增 `--language navi|pine` 參數(預設 Navi);圖表渲染同時兼容 v1 與 v2 兩種數據結構

- **美股賬戶路由** — `company`、`valuation`、`financial-report`、`consensus`、`dividend`、`order`、`positions` 在美股數據中心賬戶下自動路由至美股 API
- **新增 `etf-docs` 命令** — 列出美股 ETF 監管文件(招股書、事實說明書、年報),`--limit` 控制返回數量
- **新增 `financial-report key-metrics` 子命令** — 美股關鍵財務指標,支持 `--report annual|quarterly`
- **新增 `profit-analysis realized` 子命令** — 美股賬戶已實現盈虧,支持 `--category stock|option|crypto` 篩選
- **新增訂單選項** — `--status pending|history|all` 和 `--action buy|sell` 篩選美股歷史委託;`order detail --attached` 獲取關聯子委託

### [v0.24.0](https://github.com/longbridge/longbridge-terminal/releases/tag/v0.24.0)

- **新增 `macrodata` 命令** — 瀏覽 400+ 宏觀數據指標,覆蓋美/港/中/歐/日/新六大市場;列表模式支持 `--country` 篩選,歷史模式支持 `--start`/`--end` 日期區間;`--format json` 滿足 AI / 腳本需求
Expand Down
16 changes: 16 additions & 0 deletions docs/zh-HK/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ Longbridge OpenAPI SDK 基於 Rust 底層提供標準實現,目前我們已經
SDK 會自動選擇接入點;若判斷不正確,可設定環境變數 `LONGBRIDGE_REGION`(如 `cn`、`hk`)。
:::

### 接入點與數據中心

兩個容易混淆的概念:

- **接入點**(`.com` / `.cn`)— 僅是網路路由。兩者數據一致、鑑權一致,一方簽發的 token 另一方同樣接受。
- **數據中心**(`ap` / `us`)— 賬戶本身所在的位置,決定了哪些美股專屬接口可用。

兩者不能自由組合:

| 數據中心 | `.com` | `.cn` |
| --------------------- | -------------------- | ------ |
| `us`(美國賬戶) | 支援,且是唯一接入點 | 不支援 |
| `ap`(新加坡 / 香港) | 支援 | 支援 |

`.cn` 沒有通往美國數據中心的鏈路,因此美國賬戶必須始終使用 `.com` 域名,登入同樣如此 —— `.cn` 的登入頁不提供美國賬戶選項。

## 時間格式

所有 API 傳回有關時間的字段,我們都採用 [Unix Timestamp](https://en.wikipedia.org/wiki/Unix_time) 時區為 UTC。
Expand Down
4 changes: 3 additions & 1 deletion docs/zh-HK/docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Longbridge 提供託管的 MCP(Model Context Protocol)服務,讓你在 Cha

- 全球:`https://mcp.longbridge.com`
- 中國大陸:`https://mcp.longbridge.cn`(訪問更快)
:::

美國賬戶請使用全球地址 —— `.cn` 沒有通往美國數據中心的鏈路,僅服務 AP 賬戶(新加坡 / 香港)。詳見[接入點與數據中心](/zh-HK/docs/getting-started#接入點與數據中心)。
:::

## 可用能力

Expand Down
Loading