Webull CLI
Command-line trading tool for AI Agents, quant developers, and institutional clients. Covers Hong Kong stocks, US stocks/ETFs, US options, and China A-shares (Stock Connect).
Source code: webull-inc/webull-openapi-cli
What is Webull CLI
Webull CLI (webull) is a single-binary Go tool that wraps the Webull OpenAPI into a structured command-line interface. It provides multi-market trading and market data access through HMAC-signed REST requests.
Capabilities
| Asset Class | Trading | Market Data |
|---|---|---|
| US Stocks/ETFs | ✓ | ✓ |
| US Options | ✓ | — |
| HK Stocks/ETFs | ✓ | ✓ |
| A-Shares (Stock Connect) | ✓ | ✓ |
Architecture Overview
Prerequisites
API Credentials
- Production
- Test Environment
Apply based on your account type:
Individual users: Trading API Application Guide
Institutional users: Broker API Application Guide
No application required. Use the publicly shared test credentials to get started immediately. See SDKs and Tools.
Other Requirements
- Go 1.21+ (for
go install) or download pre-built binary - Webull App (if 2FA verification is required)
- Market Data Subscription (for real-time quotes): Subscription Guide
Setup Steps
Step 1: Install Go Environment
Check if Go is already installed:
go version
If not installed or version is below 1.21, install Go:
# macOS (Homebrew)
brew install go
# Linux
wget https://go.dev/dl/go1.22.5.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
# Windows — download installer from https://go.dev/dl/
Step 2: Install Webull CLI
go install github.com/webull-inc/webull-openapi-cli/cmd/webull@latest
Or download pre-built binary from GitHub Releases.
Ensure $GOPATH/bin is in your PATH:
export PATH=$PATH:$(go env GOPATH)/bin
Verify:
webull version
Step 3: Authenticate
webull auth login --region hk
Enter App Key: <your-app-key>
Enter App Secret: <hidden>
Checking 2FA configuration...
✓ Profile "default" created (region: hk, auth: ak_sk)
Step 4: Verify Connection
webull doctor
Step 5: Verify Account Access
webull account list
Usage Examples
Market Data:
# HK stock snapshot
webull data stock snapshot --symbol 00700,09988 --category HK_STOCK
# US stock snapshot
webull data stock snapshot --symbol AAPL,TSLA --category US_STOCK
# A-share snapshot
webull data stock snapshot --symbol 600519 --category CN_STOCK
# HK stock daily bars
webull data stock bars --symbol 00700 --category HK_STOCK --timespan D --count 200
# Batch bars
webull data stock batch-bars --symbol 00700,09988 --category HK_STOCK --timespan M5 --count 100
# Order book depth
webull data stock quotes --symbol 00700 --category HK_STOCK --depth 10
# Tick-by-tick trades
webull data stock tick --symbol 00700 --category HK_STOCK --count 100
# Order-flow footprint
webull data stock footprint --symbol AAPL --category US_STOCK --timespan M1 --count 200
Trading:
# HK stock: Enhanced Limit Order
webull order stock submit --account-id <account-id> --symbol 00700 \
--side BUY --qty 100 --type ENHANCED_LIMIT --limit-price 380.00 \
--market HK --time-in-force DAY
# HK stock: At-Auction Order
webull order stock submit --account-id <account-id> --symbol 00700 \
--side BUY --qty 100 --type AT_AUCTION \
--market HK --time-in-force DAY
# US stock: Limit Order
webull order stock submit --account-id <account-id> --symbol AAPL \
--side BUY --qty 10 --type LIMIT --limit-price 185.00 \
--market US --time-in-force DAY
# US option
webull order option submit --account-id <account-id> --symbol AAPL \
--side BUY --qty 1 --option-type CALL --strike 190 --expiry 2026-04-17
# A-share: Limit Order
webull order stock submit --account-id <account-id> --symbol 600519 \
--side BUY --qty 100 --type LIMIT --limit-price 1800.00 \
--market CN --time-in-force DAY
Order Management:
webull order open --account-id <account-id>
webull order stock replace --account-id <account-id> \
--client-order-id cli_stock_123456 --limit-price 385.00
webull order cancel --account-id <account-id> --client-order-id cli_stock_123456 -y
webull order history --account-id <account-id>
Account:
webull account balance --account-id <account-id>
webull account positions --account-id <account-id>
Available Commands
Orders
| Command | Description |
|---|---|
order stock submit | Place stock order (supports HK, US, and A-share order types) |
order stock preview | Preview stock order cost |
order stock replace | Modify a stock order |
order option submit | Place single-leg option order (US) |
order option preview | Preview option order cost |
order option replace | Modify an option order |
order cancel | Cancel any unfilled order |
order open | List open/pending orders |
order detail | Get order details |
order history | Get historical orders |
Market Data
| Command | Description |
|---|---|
data stock snapshot | Real-time snapshot (HK/US/CN) |
data stock bars | OHLCV bars (single symbol) |
data stock batch-bars | OHLCV bars (batch) |
data stock quotes | Order book depth |
data stock tick | Tick-by-tick trades |
data stock footprint | Large order footprint |
HK-Specific Order Types
| Order Type | Description |
|---|---|
ENHANCED_LIMIT | Enhanced Limit Order |
AT_AUCTION | At-Auction Order |
AT_AUCTION_LIMIT | At-Auction Limit Order |
STOP_LOSS | Stop Loss |
STOP_LOSS_LIMIT | Stop Loss Limit |
TRAILING_STOP_LOSS | Trailing Stop Loss |
TRAILING_STOP_LOSS_LIMIT | Trailing Stop Loss Limit |
TOUCH_MKT | Touch Market |
TOUCH_LMT | Touch Limit |
Configuration
Environment Endpoints
See API Environments for production and test endpoint details.
Flags
| Flag | Description |
|---|---|
--profile | Use a specific profile |
--region | Override region |
--env | Environment (prod / uat) |
--csv | CSV output |
-q, --quiet | Suppress non-data output |
--verbose | Show HTTP request summary |
--debug | Show full request/response |
--timeout | HTTP timeout in seconds (default 30) |
-y, --yes | Skip confirmation prompts |
Security Recommendations
- Never share App Key, App Secret, or Token in chat
- Use
--dry-runto validate parameters without network calls - Use
order previewto estimate costs before live orders - In live mode, orders require confirmation unless
-yis passed - Use test environment for testing before production
Disclosure
Trading in securities and options involves substantial risk of loss. All trading decisions are at your own discretion. Verify order details before execution. This software is provided "as is" without warranty.
Related Links
- GitHub: webull-inc/webull-openapi-cli