Accounts
The Account API lets you retrieve your account list, query balances, and check current positions. These are typically the first calls you make before placing any orders.
Available Endpoints
| Endpoint | Description |
|---|---|
| Account List | Retrieve all accounts under your credentials |
| Account Balance | Query balance, buying power, and cash details for a specific account |
| Account Positions | Retrieve current holdings and positions for a specific account |
Typical Workflow
- Call Account List to get your
account_id - Use the
account_idto query Balance or Positions - Based on balance and positions, decide on your trading strategy
tip
The Account List response includes all accounts associated with your credentials. Stock and options accounts may have separate Account IDs.
Code Examples
Get Account List
- Python
- Java
from webull.core.client import ApiClient
from webull.trade.trade_client import TradeClient
api_client = ApiClient("<your_app_key>", "<your_app_secret>", "hk")
api_client.add_endpoint("hk", "<api_endpoint>")
trade_client = TradeClient(api_client)
res = trade_client.get_account_list()
if res.status_code == 200:
accounts = res.json()
for account in accounts:
print(f"Account ID: {account['account_id']}, Type: {account['account_type']}")
import com.webull.openapi.core.http.HttpApiConfig;
import com.webull.openapi.trade.TradeClient;
HttpApiConfig config = HttpApiConfig.builder()
.appKey("<your_app_key>")
.appSecret("<your_app_secret>")
.regionId("hk")
.endpoint("<api_endpoint>")
.build();
TradeClient client = new TradeClient(config);
var accounts = client.getAccountList();
System.out.println("Accounts: " + accounts);
Query Account Balance
- Python
- Java
account_id = "<your_account_id>"
res = trade_client.get_account_balance(account_id=account_id)
if res.status_code == 200:
print("Balance:", res.json())
String accountId = "<your_account_id>";
var balance = client.getAccountBalance(accountId);
System.out.println("Balance: " + balance);
Query Account Positions
- Python
- Java
res = trade_client.get_account_positions(account_id=account_id)
if res.status_code == 200:
print("Positions:", res.json())
var positions = client.getAccountPositions(accountId);
System.out.println("Positions: " + positions);
What's Next
- Orders — Place and manage orders using your Account ID