
Trading Automation
Longbridge OpenAPI
Longbridge OpenAPI Skill exposes Longbridge Securities OpenAPI capabilities through a natural-language-enabled SDK for market data, order execution, and account management across Hong Kong, US, and A‑share markets.
Overview
Longbridge OpenAPI Skill exposes Longbridge Securities OpenAPI capabilities through a natural-language-enabled SDK for market data, order execution, and account management across Hong Kong, US, and A‑share markets.
Longbridge OpenAPI Skill exposes Longbridge Securities OpenAPI capabilities through a natural-language-enabled SDK for market data, order execution, and account management across Hong Kong, US, and A‑share markets. Key features include real-time market subscriptions and quote queries, multi-period candlestick data, and static instrument metadata; smart order placement (limit, market, enhanced limit), order modification/cancellation, and historical order/trade queries; and account features such as real-time balances, buying power, multi-currency support, and position details. Typical use cases include conversational trading assistants, automated execution and monitoring bots, portfolio dashboards, alerting systems, and research workflows. Core advantages are unified symbol formats, low-latency subscriptions, multi-market coverage, and programmatic control for retail and algorithmic strategies. Longbridge API credentials are required.
Skill.md
How this skill works
Longbridge OpenAPI Skill exposes Longbridge Securities OpenAPI capabilities through a natural-language-enabled SDK for market data, order execution, and account management across Hong Kong, US, and A‑share markets.
Longbridge Securities OpenAPI SDK, supporting Hong Kong and US stock trading, real-time market data subscription, and account management.
Introduction
Longbridge OpenAPI Skill is an AI skill package integrated with Longbridge Securities Open API, allowing you to interact with OpenClaw using natural language to easily complete stock market queries, trade orders, account management, and other operations.
Core Features
📊 Market Data
- Real-time Market Subscription: Subscribe to real-time market feeds for Hong Kong stocks, US stocks, and A-shares
- Stock Quote Query: Get real-time data such as latest price, volume, price change, etc.
- Candlestick Data: Support multiple periods including minute, day, week, month, and year
- Static Information: Query basic information such as stock name, exchange, currency, lot size, etc.
💰 Trading Features
- Smart Order Placement: Support various order types including limit order, market order, enhanced limit order, etc.
- Order Management: Cancel orders, modify orders
- Order Query: View today's orders, historical orders, and trade records
- Multi-market Support: Coverage of Hong Kong stocks, US stocks, and A-shares
💼 Account Management
- Fund Query: View account balance, buying power, and net assets in real-time
- Position Management: Query current positions, cost price, market value, and other information
- Multi-currency Support: Support multiple currencies including HKD, USD, CNY, etc.
Supported Markets
| Market | Code Format | Examples |
|---|---|---|
| 🇭🇰 Hong Kong | XXX.HK | 700.HK (Tencent), 9988.HK (Alibaba) |
| 🇺🇸 US Stocks | XXX.US | AAPL.US (Apple), TSLA.US (Tesla) |
| 🇨🇳 A-Shares | XXX.SH/SZ | 000001.SZ (Ping An Bank), 600519.SH (Moutai) |
Configuration Guide
1. Obtain API Credentials
Visit Longbridge Open Platform to register an account and create an application to obtain:
- App Key: Application key
- App Secret: Application secret
- Access Token: Access token
2. Configure Environment Variables
Before using this skill, you must set the following environment variables:
export LONGBRIDGE_APP_KEY="your_app_key_here"
export LONGBRIDGE_APP_SECRET="your_app_secret_here"
export LONGBRIDGE_ACCESS_TOKEN="your_access_token_here"
Persistent Configuration (Recommended):
Add to ~/.bashrc or ~/.zshrc:
# Longbridge OpenAPI Configuration
export LONGBRIDGE_APP_KEY="your_app_key_here"
export LONGBRIDGE_APP_SECRET="your_app_secret_here"
export LONGBRIDGE_ACCESS_TOKEN="your_access_token_here"
Then execute source ~/.bashrc or source ~/.zshrc to apply the configuration.
Usage Examples
Example 1: Query Stock Market Data
User Input:
Query the latest stock prices of Tencent and Alibaba
OpenClaw Operation:
- Call
get_realtime_quotetool - Parameters:
symbols=['700.HK', '9988.HK']
Response:
Tencent Holdings (700.HK)
Latest: 320.40 HKD | Change: +2.40 (+0.75%)
Open: 318.00 | High: 322.80 | Low: 317.60
Volume: 1,234,567 shares | Turnover: 395M HKD
Alibaba-SW (9988.HK)
Latest: 78.50 HKD | Change: -1.20 (-1.51%)
Open: 79.20 | High: 80.00 | Low: 78.00
Volume: 2,345,678 shares | Turnover: 184M HKD
Example 2: Get Candlestick Data
User Input:
Get the last 7 days of daily candlestick data for Apple stock
OpenClaw Operation:
- Call
get_candlestickstool - Parameters:
symbol='AAPL.US', period='day', count=7
Response: Contains 7 candlesticks with data including open, high, low, close, volume, etc.
Example 3: Submit Buy Order
User Input:
Buy 100 shares of Tencent at 320 HKD
OpenClaw Operation:
- First confirm order details with user
- Call
submit_ordertool - Parameters:
symbol='700.HK' order_type='LO' # Limit order side='Buy' quantity=100 price=320.0 time_in_force='Day'
Response:
✅ Order submitted successfully
Order ID: 123456789
Stock: Tencent Holdings (700.HK)
Side: Buy
Quantity: 100 shares
Price: 320.00 HKD
Type: Limit Order (Day)
Example 4: Query Account Information
User Input:
What is my account balance?
OpenClaw Operation:
- Call
get_account_balancetool
Response:
💰 Account Fund Status
HKD Account
Cash: 50,000.00 HKD
Buying Power: 100,000.00 HKD
Net Assets: 150,000.00 HKD
USD Account
Cash: 10,000.00 USD
Buying Power: 20,000.00 USD
Net Assets: 30,000.00 USD
Example 5: View Positions
User Input:
What stocks do I hold?
OpenClaw Operation:
- Call
get_stock_positionstool
Response:
📊 Current Positions
1. Tencent Holdings (700.HK)
Quantity: 500 shares | Available: 500 shares
Cost: 300.00 HKD | Current: 320.40 HKD
Market Value: 160,200.00 HKD | P&L: +10,200.00 (+6.80%)
2. Apple (AAPL.US)
Quantity: 100 shares | Available: 100 shares
Cost: 150.00 USD | Current: 175.50 USD
Market Value: 17,550.00 USD | P&L: +2,550.00 (+17.00%)
API Tool List
Market Data Tools
| Tool Name | Description |
|---|---|
quote_subscribe | Subscribe to real-time market feeds (quote/depth/broker/trade) |
get_realtime_quote | Get real-time stock quotes |
get_static_info | Get stock static information |
get_candlesticks | Get historical candlestick data |
Trading Tools
| Tool Name | Description |
|---|---|
submit_order | Submit trading orders |
cancel_order | Cancel orders |
get_today_orders | Get today's order list |
get_history_orders | Get historical orders |
Account Tools
| Tool Name | Description |
|---|---|
get_account_balance | Query account fund balance |
get_stock_positions | Query position list |
Order Type Description
| Type Code | Order Type | Description |
|---|---|---|
LO | Limit Order | Execute at specified price or better |
MO | Market Order | Execute immediately at current market price |
ELO | Enhanced Limit Order | Hong Kong stocks specific, can match at multiple price levels |
ALO | At-auction Limit Order | Use during auction period |
Order Time in Force
| Code | Time in Force | Description |
|---|---|---|
Day | Day Order | Valid for the current trading day |
GTC | Good Till Cancelled | Valid until filled or manually cancelled |
GTD | Good Till Date | Valid until specified date |
Security Precautions
⚠️ Risk Warnings
- Investment Risks: Stock trading involves market risks, users are responsible for their own investment decisions
- For Learning Only: This skill is for technical learning and research only, does not constitute investment advice
- Use with Caution: Do not use directly in production environment without thorough testing
🔒 Security Recommendations
- Protect Keys: Keep API keys secure, do not leak to others or commit to code repositories
- Test with Demo: Recommend testing with Longbridge demo account first
- Order Confirmation: All trading operations should be confirmed manually before execution
- Permission Control: Recommend setting minimum necessary permissions for API keys
- Regular Rotation: Regularly rotate API keys to improve security
Technical Architecture
┌──────────────────┐
│ OpenClaw │ ← User natural language interaction
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Longbridge Skill │ ← Skill layer (tool invocation)
│ (skill.py) │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Longbridge SDK │ ← Python SDK (FFI)
│ (longbridge) │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Longbridge API │ ← REST API / WebSocket
│ (HTTP/WebSocket) │
└──────────────────┘
Dependencies
Best used for
When to use it
Longbridge OpenAPI Skill exposes Longbridge Securities OpenAPI capabilities through a natural-language-enabled SDK for market data, order execution, and account management across Hong Kong, US, and A‑share markets.

01 · PRE-MEETING
Prepare a decision brief
Turn scattered evidence into a structured case before an investment committee meeting.

02 · TEAM WORKFLOW
Standardize handoffs
Create consistent research outputs across analysts, portfolio managers, and agents.

03 · LIVE UPDATE
Refresh the thesis
Update scenarios after a new catalyst, KPI release, or earnings result.
Community notes
Built to improve with use.
随着 Skill 被使用与评审,反馈将展示在这里。
Discover more
Related skills
View allquant-analysis
Quantitative Analysis Skill provides an end-to-end toolkit for quantitative finance research and production analysis. It automates data ingestion, interactive analysis in Jupyter (jupyter_execute,…
bankr
Bankr enables executing crypto trading and DeFi operations via natural-language commands. It offers two integration options: a batteries-included Bankr CLI and a REST API at https://api.bankr.bot,…
pine-backtester
pine-backtester provides comprehensive backtesting for Pine Script indicators and strategies. Use it to append performance metrics, analyze trades, generate equity curves, compute win rates, track…