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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ Longbridge Developers is the official developer platform for Longbridge — prov

## Access methods

| Method | Best for |
| ------------------------------------------------------- | ---------------------------------------------------- |
| [SDK](https://open.longbridge.com/sdk) | Python, Rust, Node.js, Go, Java, C++ apps |
| Method | Best for |
| ------------------------------------------------------------ | ---------------------------------------------------- |
| [SDK](https://open.longbridge.com/sdk) | Python, Rust, Node.js, Go, Java, C++ apps |
| [HTTP / WebSocket API](https://open.longbridge.com/docs/api) | Any language, custom integrations |
| [CLI](https://open.longbridge.com/docs/cli) (`longbridge`) | Terminal workflows, scripting, AI tool-calling |
| [MCP](https://open.longbridge.com/docs/mcp) | AI coding assistants (Cursor, Claude, ChatGPT, etc.) |
| [Skill](https://open.longbridge.com/skill) | Give any AI direct knowledge of Longbridge APIs |
| [Skill](https://open.longbridge.com/skill) | Give any AI direct knowledge of Longbridge APIs |

## Quick start

Expand All @@ -59,7 +59,7 @@ Log in to [open.longbridge.com](https://open.longbridge.com), complete developer

```bash
brew install --cask longbridge/tap/longbridge-terminal
longbridge login
longbridge auth login
longbridge quote TSLA.US NVDA.US 700.HK
```

Expand Down
14 changes: 10 additions & 4 deletions docs/.vitepress/theme/components/NewHomePage/ProductCLI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const features = [
key: 'feat4',
icon: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg>`,
terminal: [
{ type: 'cmd', text: '$ longbridge login' },
{ type: 'cmd', text: '$ longbridge auth login' },
{ type: 'blank', text: '' },
{ type: 'comment', text: ' Visit this URL in your browser:' },
{ type: 'data', text: ' https://open.longbridge.com/oauth/device' },
Expand Down Expand Up @@ -428,7 +428,9 @@ function copyInstall() {
border-bottom: 2px solid transparent;
margin-bottom: -1px;
cursor: pointer;
transition: color 0.2s, border-color 0.2s;
transition:
color 0.2s,
border-color 0.2s;
}
.cli-install-tab:hover {
color: var(--vp-c-text-2);
Expand Down Expand Up @@ -500,7 +502,9 @@ function copyInstall() {
.cli-terminal {
border-radius: 0.75rem;
overflow: hidden;
transition: background 0.3s, border-color 0.3s;
transition:
background 0.3s,
border-color 0.3s;
}

/* Dark theme (original) */
Expand Down Expand Up @@ -642,7 +646,9 @@ function copyInstall() {
white-space: pre;
opacity: 0;
transform: translateY(4px);
transition: opacity 0.12s, transform 0.12s;
transition:
opacity 0.12s,
transform 0.12s;
}
.cli-line.visible {
opacity: 1;
Expand Down
15 changes: 13 additions & 2 deletions docs/en/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ sidebar_position: 7
sidebar_icon: newspaper
---

## 2026-04-15

### CLI v0.17.0

- **`auth` subcommand group** — `longbridge auth login` / `auth logout` / `auth status`; new `auth status` shows token validity, expiry, and account info locally without network
- **`alert enable` / `alert disable`** — toggle alerts on/off without deleting them

## 2026-04-13

### CLI v0.16.0
Expand All @@ -21,6 +28,7 @@ sidebar_icon: newspaper

- **`portfolio` command** — total P/L, asset distribution by market, holdings, and cash balances
- **`investors` command** — active fund manager rankings from SEC 13F data; view any investor's holdings by CIK with live prices

```
$ longbridge investors
| # | name | AUM | period | cik |
Expand Down Expand Up @@ -51,7 +59,9 @@ sidebar_icon: newspaper
| KRAFT HEINZ CO | $7.90B | 325.63M | 2.9% |
| ALPHABET INC | $5.59B | 17.85M | 2.0% |
```

- **`insider-trades`** — SEC Form 4 insider transaction history for any symbol

```
$ longbridge insider-trades TSLA.US
Fetching 20 Form 4 filings...
Expand All @@ -65,6 +75,7 @@ sidebar_icon: newspaper

Source: SEC EDGAR Form 4 — TSLA
```

- **`watchlist pin/unpin`** — pin securities to the top of a watchlist group
- **`assets` command** — renamed from `balance`; full asset overview: net assets, buying power, margin, risk level, and per-currency cash breakdown

Expand All @@ -78,12 +89,12 @@ sidebar_icon: newspaper

### CLI v0.14.1

- **CN region login** — `longbridge login` now supports China region routing
- **CN region login** — `longbridge auth login` now supports China region routing
- **`-v` flag** — quick version check

### CLI v0.14.0

- **Device auth** — the Longbridge Developers platform now supports OAuth Device Authorization Flow; `longbridge login` displays a verification URL and code to authorize from any device, including SSH and headless environments
- **Device auth** — the Longbridge Developers platform now supports OAuth Device Authorization Flow; `longbridge auth login` displays a verification URL and code to authorize from any device, including SSH and headless environments
- **Order enhancements** — trailing stop and AO order types; `--expire-date`, `--outside-rth`, `--remark` added to order commands
- **Fix** — prebuilt Linux binary now uses musl to fix segfault on some distributions

Expand Down
9 changes: 9 additions & 0 deletions docs/en/docs/cli/account/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ longbridge alert add TSLA.US --price 300 --direction rise
longbridge alert add AAPL.US --price 150 --direction fall
```

### Enable / Disable an alert

```bash
# Disable an alert (keeps it without deleting)
longbridge alert disable 112326
# Re-enable a disabled alert
longbridge alert enable 112326
```

### Delete an alert

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/en/docs/cli/account/statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ When `-o` is provided, the default export format switches to CSV. Each section i

## Requirements

A valid OAuth login is required. Run `longbridge login` if you have not yet authenticated.
A valid OAuth login is required. Run `longbridge auth login` if you have not yet authenticated.
2 changes: 1 addition & 1 deletion docs/en/docs/cli/content/topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ Posts a reply to a community topic. Use `--reply-to` with a reply ID (from `topi

## Requirements

A valid OAuth login is required for `mine`, `create`, and `create-reply`. Run `longbridge login` if you have not yet authenticated.
A valid OAuth login is required for `mine`, `create`, and `create-reply`. Run `longbridge auth login` if you have not yet authenticated.
36 changes: 25 additions & 11 deletions docs/en/docs/cli/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,41 @@ iwr https://open.longbridge.com/longbridge/longbridge-terminal/install.ps1 | iex
</TabItem>
</Tabs>

## login
## auth

Manage authentication — login, logout, and check token status.

### auth login

Authenticate via OAuth 2.0 device authorization flow — works in any environment including SSH
and headless servers.

```bash
longbridge login
longbridge auth login
```

Running `login` prints a URL and a short code. Open the URL in any browser, enter the code,
Running `auth login` prints a URL and a short code. Open the URL in any browser, enter the code,
and authorize. The token is saved to `~/.longbridge/openapi/tokens/<client_id>` and reused
automatically by all subsequent commands.

### auth logout

Clears the stored OAuth token. The next command or TUI launch will trigger re-authentication.

```bash
longbridge auth logout
```

### auth status

Shows token validity locally — no network required. Displays expiry time, login time, account
info, and current quote level.

```bash
longbridge auth status
longbridge auth status --format json
```

## check

Verifies token validity and API connectivity. Shows token status, cached region, and latency
Expand All @@ -75,11 +97,3 @@ release.
```bash
longbridge update
```

## logout

Clears the stored OAuth token. The next command or TUI launch will trigger re-authentication.

```bash
longbridge logout
```
9 changes: 7 additions & 2 deletions docs/en/docs/cli/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ sidebar_icon: newspaper

# Release Notes

### v0.17.0

- **`auth` subcommand group** — `longbridge auth login`, `auth logout`, `auth status`; `auth status` shows token validity, expiry, account info, and quote level locally without network
- **`alert enable` / `alert disable`** — toggle price alerts on/off without deleting them

### v0.16.1

**Enhancements**
Expand Down Expand Up @@ -66,12 +71,12 @@ sidebar_icon: newspaper

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

- **New: CN region login** — `longbridge login` now supports China region routing
- **New: CN region login** — `longbridge auth login` now supports China region routing
- **New: `-v` flag** — show version without entering the full command

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

- **New: Device auth login** — `longbridge login` now uses OAuth device flow; displays a URL and code to authorize on any device, works in SSH and headless environments; `--headless` flag removed
- **New: Device auth login** — `longbridge auth login` now uses OAuth device flow; displays a URL and code to authorize on any device, works in SSH and headless environments; `--headless` flag removed
- **New: Order enhancements** — trailing stop and AO order types; `--expire-date`, `--outside-rth`, `--remark` added to order commands
- **Fix: Linux segfault** — prebuilt Linux binary now uses musl to fix crash on some distributions

Expand Down
2 changes: 1 addition & 1 deletion docs/en/docs/cli/tui.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ your watchlist.

## Notes

- Requires a valid `longbridge login` session
- Requires a valid `longbridge auth login` session
- The TUI shares the same token as CLI commands
- Press `q` or `Ctrl+C` to quit
2 changes: 1 addition & 1 deletion docs/en/docs/cli/watchlist/watchlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ Permanently deletes a watchlist group and all its securities. Run `longbridge wa

## Requirements

A valid OAuth login is required. Run `longbridge login` if you have not yet authenticated.
A valid OAuth login is required. Run `longbridge auth login` if you have not yet authenticated.
24 changes: 12 additions & 12 deletions docs/en/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ iwr https://open.longbridge.com/longbridge/longbridge-terminal/install.ps1 | iex
### Login

<CliCommand>
longbridge login
longbridge auth login
</CliCommand>

The browser opens the authorization page automatically. The token is saved after approval — no need to repeat.
Expand Down Expand Up @@ -417,17 +417,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. |
| `LONGBRIDGE_ENABLE_OVERNIGHT` | Enable overnight quote, `true` or `false` (Default: `false`). Requires purchasing the "LV1 Real-time Quote (OpenAPI)" quote card in the Longbridge App. 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) |
| 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`). Requires purchasing the "LV1 Real-time Quote (OpenAPI)" quote card in the Longbridge App. 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) |

:::info
The SDK also accepts the legacy `LONGPORT_*` variable names for backward compatibility.
Expand Down
4 changes: 2 additions & 2 deletions docs/en/skill/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ iwr https://open.longbridge.com/longbridge/longbridge-terminal/install.ps1 | iex
**Connect your Longbridge account:**

```bash
longbridge login
longbridge auth login
```

That's it. The AI can now call `longbridge` commands on your behalf.
Expand Down Expand Up @@ -141,7 +141,7 @@ Some clients require a restart or a new conversation to load the Skill. Confirm

**Prompted for authorization when querying data**

Run `longbridge login` in your terminal and complete the OAuth flow — no API Key required.
Run `longbridge auth login` in your terminal and complete the OAuth flow — no API Key required.

**Trading operations not working**

Expand Down
2 changes: 1 addition & 1 deletion docs/public/longbridge-terminal/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ if ($userPath -notlike "*$installDir*") {
Write-Host ""
Write-Host "Longbridge CLI $version has been installed successfully."
Write-Host ""
Write-Host "Run 'longbridge login' to authenticate, then 'longbridge -h' for help."
Write-Host "Run 'longbridge auth login' to authenticate, then 'longbridge -h' for help."
Write-Host ""
15 changes: 13 additions & 2 deletions docs/zh-CN/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ sidebar_position: 7
sidebar_icon: newspaper
---

## 2026-04-15

### CLI v0.17.0

- **`auth` 子命令组** — `longbridge auth login` / `auth logout` / `auth status`;`auth status` 本地查看 Token 有效性和账户信息,无需网络
- **`alert enable` / `alert disable`** — 切换价格提醒启用状态,无需删除重建

## 2026-04-13

### CLI v0.16.0
Expand All @@ -21,6 +28,7 @@ sidebar_icon: newspaper

- **`portfolio` 命令** — 组合总损益、各市场资产分布、持仓及现金明细
- **`investors` 命令** — 基于 SEC 13F 数据的主动基金经理排行榜,按 CIK 查询指定投资者持仓(含实时价格)

```
$ longbridge investors
| # | name | AUM | period | cik |
Expand Down Expand Up @@ -51,7 +59,9 @@ sidebar_icon: newspaper
| KRAFT HEINZ CO | $7.90B | 325.63M | 2.9% |
| ALPHABET INC | $5.59B | 17.85M | 2.0% |
```

- **`insider-trades`** — 查看任意标的的内部人士交易记录(SEC Form 4)

```
$ longbridge insider-trades TSLA.US
Fetching 20 Form 4 filings...
Expand All @@ -65,6 +75,7 @@ sidebar_icon: newspaper

Source: SEC EDGAR Form 4 — TSLA
```

- **`watchlist pin/unpin`** — 将标的置顶至自选股分组顶部
- **`assets` 命令** — 原 `balance` 更名,展示完整资产概览:净资产、购买力、保证金、风险等级及分币种现金明细

Expand All @@ -78,12 +89,12 @@ sidebar_icon: newspaper

### CLI v0.14.1

- **CN 区域登录** — `longbridge login` 支持中国大陆区域路由
- **CN 区域登录** — `longbridge auth login` 支持中国大陆区域路由
- **`-v` 标志** — 快速查看版本号

### CLI v0.14.0

- **Device Auth** — Longbridge Developers 平台现已支持 OAuth Device Auth 授权流程;`longbridge login` 显示验证 URL 和 Code,可在任意设备完成授权,支持 SSH 和无头环境
- **Device Auth** — Longbridge Developers 平台现已支持 OAuth Device Auth 授权流程;`longbridge auth login` 显示验证 URL 和 Code,可在任意设备完成授权,支持 SSH 和无头环境
- **订单增强** — 支持追踪止损和 AO 订单类型;订单命令新增 `--expire-date`、`--outside-rth`、`--remark` 参数
- **修复** — Linux 预构建二进制改为 musl,修复在部分发行版的 Segfault

Expand Down
9 changes: 9 additions & 0 deletions docs/zh-CN/docs/cli/account/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ longbridge alert add TSLA.US --price 300 --direction rise
longbridge alert add AAPL.US --price 150 --direction fall
```

### 启用 / 停用提醒

```bash
# 停用提醒(保留设置,不删除)
longbridge alert disable 112326
# 重新启用已停用的提醒
longbridge alert enable 112326
```

### 删除提醒

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/docs/cli/account/statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ longbridge statement export --file-key stmt_daily_20260410_abc123 --section equi

## 前置条件

需要有效的 OAuth 登录。如未认证请先执行 `longbridge login`。
需要有效的 OAuth 登录。如未认证请先执行 `longbridge auth login`。
2 changes: 1 addition & 1 deletion docs/zh-CN/docs/cli/content/topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ longbridge topic create-reply 39798312 --body "同意" --reply-to 50012345

## 前置条件

`mine`、`create` 和 `create-reply` 需要有效的 OAuth 登录。如未认证请先执行 `longbridge login`。
`mine`、`create` 和 `create-reply` 需要有效的 OAuth 登录。如未认证请先执行 `longbridge auth login`。
Loading
Loading