Skip to content

Repository files navigation

Webull OpenAPI CLI

CLI for Webull OpenAPI. Trade stocks, options, futures, crypto, and event contracts, access market data, and manage your account from the terminal.

Alpha Preview — This CLI is under active development. Commands, flags, and output formats may change between releases.

Features

  • Full asset coverage: Stocks, options, futures, crypto, event contracts
  • Multi-region: US, HK, JP, SG, TH, AU, MY, UK, BR, MX, EU, ZA
  • Agent-first design: JSON output, --quiet mode, structured errors, explicit exit codes
  • AK/SK authentication: HMAC signature + optional 2FA token
  • Safety: Order confirmation prompts (skip with -y), --dry-run mode
  • Scriptable: Pipe-friendly, --csv export

Install

Download pre-built binary (recommended):

Download the latest binary for your platform from Releases, extract, and add to your PATH.

Go install (requires Go 1.26.2+):

go install github.com/webull-inc/webull-openapi-cli/cmd/webull@latest

From source:

git clone https://github.com/webull-inc/webull-openapi-cli.git
cd webull-openapi-cli
go build ./cmd/webull/
# Produces: webull (macOS/Linux) or webull.exe (Windows)

Add to PATH (so you can use webull directly):

# macOS/Linux: add to ~/.zshrc or ~/.bashrcexport PATH="$PATH:$HOME/go/bin"# if using go installexport PATH="$PATH:/path/to/bin"# if using make build# Windows (PowerShell):$env:PATH += ";C:\path\to\webull"# Or move webull.exe to a directory already in PATH

Quick Start

# Authenticate
webull auth login --region us
# Check your account
webull account list
# Get a stock quote
webull data stock snapshot --symbol AAPL
# Place an order
webull order stock submit --account-id ACC123 --symbol AAPL --side buy --qty 10 --type market -y
# View positions
webull account positions --account-id ACC123
# Query instrument info
webull instrument stock --symbol AAPL
# Check top gainers
webull data screener gainers-losers --direction DESC
# Get company fundamentals
webull data fundamentals company-profile --symbol AAPL
webull data fundamentals earnings-calendar --symbol 00700 --category HK_STOCK

Authentication

AK/SK + 2FA (Phase 1)

webull auth login --region us

Prompts for App Key and App Secret. If 2FA is enabled, you'll be asked to verify in the Webull App.

Credentials (AK/SK and 2FA token) are stored securely in the system keychain:

  • macOS: Keychain Access (service: webull-cli)
  • Windows: Credential Manager
  • Linux: Secret Service (gnome-keyring / KDE Wallet)

Non-sensitive profile data (region, env, endpoints) is stored in ~/.config/webull/profiles.json (macOS/Linux) or %USERPROFILE%\.config\webull\profiles.json (Windows).

UAT Environment

For non-production environments, you must provide endpoint hosts explicitly:

webull auth login --region hk --env uat \
--api-endpoint api.sandbox.webull.hk \
--name hk-sandbox

--api-endpoint is required for UAT.

Environment Variables

For CI/automation, use environment variables instead of interactive login:

export WEBULL_APP_KEY=your-app-key
export WEBULL_APP_SECRET=your-app-secret
webull account list

Credential Precedence

  1. Environment variables (WEBULL_APP_KEY + WEBULL_APP_SECRET)
  2. --profile flag
  3. Active profile from config file

Commands

Trading (webull order)

Orders are organized by asset class under webull order <asset>:

CommandDescription
webull order stock submitPlace a stock/ETF order
webull order stock previewPreview stock order fees
webull order stock replaceModify a stock order
webull order stock comboPlace a combo order (OTO/OCO/OTOCO) via JSON
webull order option submitPlace a single-leg option order
webull order option previewPreview option order fees
webull order option replaceModify an option order
webull order option strategyPlace a multi-leg option strategy via JSON
webull order futures submitPlace a futures order
webull order futures replaceModify a futures order
webull order crypto submitPlace a crypto order
webull order event submitPlace an event contract order
webull order event replaceModify an event contract order
webull order cancelCancel an order (any asset)
webull order openList open orders
webull order detailGet order details
webull order historyOrder history

Market Data (webull data)

Data is organized by asset class under webull data <asset>:

CommandDescription
webull data stock snapshotReal-time stock snapshot
webull data stock barsHistorical candlestick bars
webull data stock batch-barsBatch historical bars (multiple symbols)
webull data stock quotesDepth quotes (bid/ask)
webull data stock tickTick-by-tick trades
webull data stock footprintLarge order footprint
webull data stock noii-barsNOII (Net Order Imbalance) bars
webull data stock noii-snapshotNOII snapshot
webull data option snapshotOption real-time snapshot
webull data option barsOption historical bars
webull data option tickOption tick data
webull data futures snapshotFutures snapshot
webull data futures barsFutures historical bars
webull data futures tickFutures tick data
webull data futures footprintFutures footprint data
webull data futures depthFutures depth of book
webull data crypto snapshotCrypto snapshot
webull data crypto barsCrypto historical bars
webull data event snapshotEvent contract snapshot
webull data event barsEvent contract bars
webull data event tickEvent contract tick data
webull data event depthEvent contract order book
webull data screener gainers-losersTop gainers/losers
webull data screener activesMost active stocks
webull data screener market-sectorsMarket sector overview and rankings
webull data screener market-sectors-detailStock list for a specific sector
webull data screener high-dividendHigh dividend stocks ranking
webull data screener 52whl52-week high/low stocks
webull data fundamentals company-profileCompany profile information
webull data fundamentals analyst-priceAnalyst target price
webull data fundamentals analyst-ratingAnalyst rating
webull data fundamentals forecast-epsForecast EPS (most recent 5 quarters)
webull data fundamentals filingsSEC filings
webull data fundamentals earnings-calendarEarnings calendar
webull data fundamentals dividend-calendarDividend calendar
webull data fundamentals capital-flowCapital flow distribution
webull data fundamentals industry-comparisonIndustry peer comparison
webull data fundamentals indicatorsFinancial indicators (ROA, ROE, EPS)
webull data fundamentals incomeIncome statement
webull data fundamentals cashflowCash flow statement
webull data fundamentals balancesheetBalance sheet
webull data fundamentals alertEarnings release alert
webull data fundamentals fund-briefFund brief information
webull data fundamentals fund-performanceFund performance returns
webull data fundamentals fund-net-valueFund NAV history
webull data fundamentals fund-holdingsFund top 10 holdings
webull data fundamentals fund-dividendsFund dividend history
webull data fundamentals fund-ratingFund rating history
webull data fundamentals fund-splitsFund split history
webull data fundamentals fund-filesFund documents and files
webull data fundamentals fund-allocationFund asset allocation

Instruments (webull instrument)

CommandDescription
webull instrument stockQuery stock/ETF instruments
webull instrument cryptoQuery crypto instruments
webull instrument futuresQuery futures contracts
webull instrument futures-productsFutures product codes
webull instrument futures-classFutures product classes
webull instrument eventQuery event contract instruments
webull instrument event-categoriesList event categories
webull instrument event-seriesList event series
webull instrument event-eventsList events by series
webull instrument company-profileCompany profile (deprecated, use data fundamentals)
webull instrument analyst-priceAnalyst target price (deprecated, use data fundamentals)
webull instrument analyst-ratingAnalyst rating (deprecated, use data fundamentals)

Watchlists (webull watchlist)

CommandDescription
webull watchlist listList all watchlists
webull watchlist getGet watchlist instruments
webull watchlist createCreate a watchlist
webull watchlist updateUpdate watchlist name/sort
webull watchlist deleteDelete a watchlist
webull watchlist addAdd instruments (JSON)
webull watchlist removeRemove instruments
webull watchlist sortUpdate instruments sort order

Account

CommandDescription
webull account listList trading accounts
webull account balanceAccount balance
webull account positionsAccount positions
webull account position-detailPosition details by contract (JP)

Profile Management

CommandDescription
webull auth loginAuthenticate (AK/SK + 2FA)
webull auth statusCheck auth status
webull profile listList profiles
webull profile switchSwitch active profile
webull profile logoutRemove a profile
webull profile set-endpointOverride API endpoint

Utilities

CommandDescription
webull doctorDiagnose config and connectivity
webull versionPrint version

Every command supports --help for full flag documentation:

webull order stock submit --help # See all flags for stock submit
webull data stock bars --help # See all flags for bars query

JSON Input Mode

For complex orders (combo, strategy, or orders with array fields like close_contracts), use --body or --file:

# Inline JSON
webull order stock combo --body '{"account_id":"ACC123","new_orders":[...]}'# From file
webull order option strategy --file my_strategy.json
# Pipe from stdin
cat order.json | webull order stock combo

Output Formats

webull account positions --account-id ACC123 # JSON (default)
webull account positions --account-id ACC123 --csv # CSV
webull data stock snapshot --symbol AAPL,TSLA # Multiple symbols

Safety

  • Order confirmation: order stock submit, order cancel, and order stock replace prompt for confirmation in interactive mode. Use -y to skip.
  • Dry run: webull order stock submit --dry-run prints the request payload without submitting.
  • Credentials: AK/SK and tokens stored in system keychain (not in plaintext files). Non-sensitive config uses 0600 file permissions.

Global Flags

FlagDescription
--profileUse a specific profile
--regionOverride profile region
--envEnvironment (prod/uat)
--csvOutput in CSV format
--quietSuppress non-data output
--verboseShow request summaries on stderr
--debugShow full request/response on stderr
--timeoutHTTP timeout in seconds (default: 30)
-y, --yesSkip confirmation prompts

Exit Codes

CodeMeaning
0Success
1Any error

Errors are output as JSON to stderr with an error_code field for machine parsing:

{"error_code":"CLI_ERROR","message":"required flag(s) \"qty\", \"side\", \"type\" not set"}

Development

make build # Build binary to bin/webull
make test# Run tests
make lint # Run linter
make clean # Remove build artifacts

Contributing

See CONTRIBUTING.md for guidelines.

License

Apache 2.0 — see LICENSE for details.

Disclaimer

See DISCLAIMER.md for important risk warnings and terms of use.

About

No description, website, or topics provided.

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages