About longbridge
longbridge is a CLI wrapper for all Longbridge OpenAPI endpoints, for users and scripts that access market data and related information. It supports Hong Kong, US, and China A-share markets, with table or JSON output.
Key features
- 01Wraps Longbridge OpenAPI endpoints
- 02Supports HK, US, and China A-share markets
- 03Browser-based OAuth login and logout
- 04Checks token, region, and API connectivity
- 05Provides table and JSON output
Use cases
- 01Query market information from the CLI
- 02Retrieve stock news and filings
- 03Use API output in agents or scripts
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ longbridge/ longbridge-terminal --skill longbridgeAfter installing, type/longbridgein Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/quote-commands.mdtrade-commands.mdwatchlist-commands.mdDetails
From the project READMELongbridge CLI
A CLI that wraps all Longbridge OpenAPI endpoints. Supports Hong Kong (HK), US, and China A-share (SH/SZ) markets.
Authentication
longbridge login # Opens browser OAuth flow; token persisted by SDK
longbridge logout # Clear token
longbridge check # Verify token, region, and API endpoint connectivity (no auth required)
The CLI auto-detects China Mainland by probing geotest.lbkrs.com on each startup (background, non-blocking). The result is cached in ~/.longbridge/openapi/region-cache; if CN, all API calls use CN endpoints automatically on the next run.
Symbol Format
All symbols: <CODE>.<MARKET>
| Market | Examples |
|---|---|
HK | 700.HK (Tencent), 9988.HK (Alibaba) |
US | TSLA.US, AAPL.US, NVDA.US |
SH | 600519.SH (Kweichow Moutai) |
SZ | 000001.SZ (Ping An Bank) |
Output Formats
--format table # Human-readable (default)
--format json # Machine-readable for AI agents and scripts
Quick Reference
Most Common Commands
# Diagnostics
longbridge check
# News, filings, and community topics
longbridge news TSLA.US
longbridge news-detail <id>
longbridge filings AAPL.US # shows file count per filing
longbridge filing-detail AAPL.US <id> # default: file 0
longbridge filing-detail AAPL.US <id> --file-index 1 # e.g. Exhibit 99.1 of an 8-K
longbridge filing-detail AAPL.US <id> --list-files # list all file URLs
longbridge topics TSLA.US
longbridge topic-detail <id>
# Real-time quote
longbridge quote TSLA.US 700.HK AAPL.US
# Daily candlesticks (last 100)
longbridge kline TSLA.US --period day --count 100
# Historical data by date range
longbridge kline-history TSLA.US --start 2024-01-01 --end 2024-12-31
# Order book depth
longbridge depth TSLA.US
# Account positions
longbridge positions
# Today's orders
longbridge orders
# Submit a limit buy order
longbridge buy TSLA.US 100 --price 250.00
# Submit a market sell order
longbridge sell AAPL.US 50 --order-type MO
Reference Files
- Quote commands (quote, depth, kline, trades, options, warrants, market data): See references/quote-commands.md
- Trade commands (orders, buy, sell, positions, balance, executions): See references/trade-commands.md
- Watchlist commands (create, update, delete groups): See references/watchlist-commands.md
Load the relevant reference file based on what the user is asking about.