Skip to main content

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 ClassTradingMarket Data
US Stocks/ETFs✓✓
US Options✓—
HK Stocks/ETFs✓✓
A-Shares (Stock Connect)✓✓

Architecture Overview​


Prerequisites​

API Credentials​

Apply based on your account type:

Individual users: Trading API Application Guide

Institutional users: Broker API Application Guide

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​

CommandDescription
order stock submitPlace stock order (supports HK, US, and A-share order types)
order stock previewPreview stock order cost
order stock replaceModify a stock order
order option submitPlace single-leg option order (US)
order option previewPreview option order cost
order option replaceModify an option order
order cancelCancel any unfilled order
order openList open/pending orders
order detailGet order details
order historyGet historical orders

Market Data​

CommandDescription
data stock snapshotReal-time snapshot (HK/US/CN)
data stock barsOHLCV bars (single symbol)
data stock batch-barsOHLCV bars (batch)
data stock quotesOrder book depth
data stock tickTick-by-tick trades
data stock footprintLarge order footprint

HK-Specific Order Types​

Order TypeDescription
ENHANCED_LIMITEnhanced Limit Order
AT_AUCTIONAt-Auction Order
AT_AUCTION_LIMITAt-Auction Limit Order
STOP_LOSSStop Loss
STOP_LOSS_LIMITStop Loss Limit
TRAILING_STOP_LOSSTrailing Stop Loss
TRAILING_STOP_LOSS_LIMITTrailing Stop Loss Limit
TOUCH_MKTTouch Market
TOUCH_LMTTouch Limit

Configuration​

Environment Endpoints​

See API Environments for production and test endpoint details.

Flags​

FlagDescription
--profileUse a specific profile
--regionOverride region
--envEnvironment (prod / uat)
--csvCSV output
-q, --quietSuppress non-data output
--verboseShow HTTP request summary
--debugShow full request/response
--timeoutHTTP timeout in seconds (default 30)
-y, --yesSkip confirmation prompts

Security Recommendations​

  • Never share App Key, App Secret, or Token in chat
  • Use --dry-run to validate parameters without network calls
  • Use order preview to estimate costs before live orders
  • In live mode, orders require confirmation unless -y is 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.