Webull is a D library for the Webull OpenAPI, providing authenticated access to market data including real-time quotes, OHLCV bars, tick data, and order book depth for equities, options, crypto, and futures.
- HMAC-SHA1 Signing - Automatic request signing with app key/secret
- Token Lifecycle - Create, poll, and cache authentication tokens with MFA support
- Permission Detection - Runtime probing of available API permissions
- Bars - OHLCV candlestick data with configurable timespans (M1 through yearly)
- Snapshots - Real-time price, volume, and change data with extended/overnight hours
- Order Book - Level-2 quotes with configurable depth
- Ticks - Individual trade records with volume and direction
- Footprint - Delta volume analysis with buy/sell level breakdowns
- US Stocks -
US_STOCK - US Options -
US_OPTION - Hong Kong Stocks -
HK_STOCK - China Stocks -
CN_STOCK - Cryptocurrency -
CRYPTO - Futures -
FUTURES
Requirements:
- D compiler (DMD/LDC)
- Webull OpenAPI credentials (key + secret)
Setup:
import webull.client;
import webull.security;
import webull.market;
// Configure credentials
Client.key = "your_app_key";
Client.secret = "your_app_secret";
// Create and authenticate token
Client.createToken((status) {
writeln("Waiting for MFA approval...");
});
// Access market data
auto aapl = new Security("AAPL", Category.US_STOCK);
auto snap = aapl.snapshot();
writeln("AAPL: $", snap.price, " (", snap.changeRatio, "%)");createToken()- Initiate authentication with optional polling callbackcheckToken()- Validate current token statusdetectPermissions()- Probe available API endpoints
autoUpdate- Automatic refresh of cached market databars()- Retrieve OHLCV historysnapshot()- Current quote dataorderBook()- Bid/ask levelsticks()- Recent trades
getBars()- Single or batch bar retrievalgetSnapshot()- Single or batch snapshotsgetOrderBook()- Level-2 market depthgetTicks()- Trade tick historygetFootprint()- Volume delta analysis
webull.client- Authentication state and token managementwebull.security- Security objects with auto-updating data accessorswebull.market- Market data endpoints (bars, quotes, ticks, snapshots, footprint)webull.composer- HMAC-SHA1 request signing and HTTP orchestration
- HMAC-SHA1 authentication
- Token lifecycle management
- Bars API (single + batch)
- Snapshots API (single + batch)
- Order book API
- Tick data API
- Footprint API
- WebSocket streaming
- Order placement API
- Account/position queries
Webull is licensed under the AGPL-3.0 license.