mcpField
L
longbridge

longbridge

github.com/longbridgeOther1.0k45 installsUpdated 3d ago
Repository

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

  1. 01Wraps Longbridge OpenAPI endpoints
  2. 02Supports HK, US, and China A-share markets
  3. 03Browser-based OAuth login and logout
  4. 04Checks token, region, and API connectivity
  5. 05Provides table and JSON output

Use cases

  1. 01Query market information from the CLI
  2. 02Retrieve stock news and filings
  3. 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 longbridge

After installing, type/longbridgein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
quote-commands.md
trade-commands.md
watchlist-commands.md

Details

From the project README

Longbridge 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>

MarketExamples
HK700.HK (Tencent), 9988.HK (Alibaba)
USTSLA.US, AAPL.US, NVDA.US
SH600519.SH (Kweichow Moutai)
SZ000001.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

Load the relevant reference file based on what the user is asking about.

Comments

Markdown supported