npx skills add longbridge/skills --skill longbridge
starchild-ai-agent/official-skills
longbridge
Longbridge / LongPort (长桥证券) — US/HK/A-share stocks. Account, positions, orders, quotes, history, and order placement. Use when the user wants to check or trade a Longbridge / 长桥 account (e.g. "Longbridge balance", "buy 100 700.HK on Longbridge", "my 长桥 positions"). Cloud API via the official longport SDK, runs in the container.
Installation
npx skills add starchild-ai-agent/official-skills --skill longbridge
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Helps users discover and install agent skills when they ask questions like "how do I do X", "fi…
3.3M installsBrowser automation CLI for AI agents. Use when the user needs to interact with websites, includ…
810.4K installsReview UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "chec…
617.3K installsBuild, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and …
576.5K installsPrepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Te…
568.3K installsAlso in this package
Other skills from starchild-ai-agent/official-skills · top by installs.
npx skills add starchild-ai-agent/official-skills
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
npx skills add https://github.com/longbridge/developers
Repository health
main
Skill metadata
Parsed from SKILL.md frontmatter.
More metadata
- starchild
- {"emoji":"🌉","skillKey":"longbridge","requires":{"env":["LONGPORT_APP_KEY","LONGPORT_APP_SECRET","LONGPORT_ACCESS_TOKEN"]},"install":{"0":"kind: pip","package":"longport"}}
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md3,823 B -
docs
SUMMARY.md366 B
History
- First seen on skills.sh
- First recorded snapshot · 45 installs
SKILL.md
What this is
☁️ Cloud broker — runs directly in the container via the official longport SDK (formerly longbridge). Covers US, HK, and A-share markets.
Auth is static key: App Key + App Secret + Access Token. These use the SDK's own env var names so they're picked up automatically.
⚠️ No paper/live discriminator exists in the API. Paper vs live is determined only by which Access Token you loaded — there is no field, account prefix, or host that distinguishes them. So --profile here is trust-declared (echoed back as paperguard: configdeclared); it does not verify anything on the server. Live placement still requires --confirm-live. Treat the token you configure as authoritative for which environment you're in.
Get your credentials
- Open a Longbridge account, then go to the LongPort OpenAPI console (开放平台).
- Apply for / enable OpenAPI access. The console issues three values:
- App Key - App Secret - Access Token (has an expiry — regenerate when it lapses)
- For paper trading, generate the token while your account/environment is in the paper/模拟 mode the platform offers; for live, use the live token. (Same three field names either way.)
Configure (.env)
Request via secure input — never paste keys in chat. These are the SDK's standard names:
| Variable | Required | Notes |
|---|---|---|
LONGPORTAPPKEY |
yes | App Key |
LONGPORTAPPSECRET |
yes | App Secret |
LONGPORTACCESSTOKEN |
yes | Access Token (expires — refresh when needed) |
Usage
pip install longport (first run). JSON output. Default profile paper (label only).
python skills/longbridge/scripts/longbridge_cli.py status
python skills/longbridge/scripts/longbridge_cli.py account
python skills/longbridge/scripts/longbridge_cli.py positions
python skills/longbridge/scripts/longbridge_cli.py orders [--executions]
python skills/longbridge/scripts/longbridge_cli.py quote --symbol 700.HK
python skills/longbridge/scripts/longbridge_cli.py history --symbol AAPL.US --period 1d --limit 90
# place: qty in shares only; market or limit
python skills/longbridge/scripts/longbridge_cli.py place --symbol 700.HK --side buy --qty 100 --type limit --limit-price 350
python skills/longbridge/scripts/longbridge_cli.py cancel --order-id <id>
# live (real money): add --confirm-live (profile is label-only)
python skills/longbridge/scripts/longbridge_cli.py --confirm-live place --symbol AAPL.US --side buy --qty 1
Symbol format is mandatory: <ticker>.<market> — 700.HK, AAPL.US, 000001.SZ, 600519.SH. Periods: 1m 5m 15m 30m 1h 1d 1w 1M.
Gotchas
- Longbridge has no notional path — always
--qty(shares). - The Access Token expires; if calls start failing auth, regenerate it in the console and update
.env. - Because there's no server-side paper/live check, double-check which token you loaded before any live order — the CLI can't catch a mislabeled environment for you.