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, options, futures, and crypto 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>", "us")
api_client.add_endpoint("us", "<api_endpoint>")
trade_client = TradeClient(api_client)
res = trade_client.account_v2.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.TradeClientV2;
HttpApiConfig config = HttpApiConfig.builder()
.appKey("<your_app_key>")
.appSecret("<your_app_secret>")
.regionId("us")
.endpoint("<api_endpoint>")
.build();
TradeClientV2 client = new TradeClientV2(config);
var accounts = client.getAccountList();
System.out.println("Accounts: " + accounts);
Query Account Balance
- Python
- Java
from webull.core.client import ApiClient
from webull.trade.trade_client import TradeClient
api_client = ApiClient("<your_app_key>", "<your_app_secret>", "us")
api_client.add_endpoint("us", "<api_endpoint>")
trade_client = TradeClient(api_client)
account_id = "<your_account_id>"
res = trade_client.account_v2.get_account_balance(account_id)
if res.status_code == 200:
print("Balance:", res.json())
import com.webull.openapi.core.http.HttpApiConfig;
import com.webull.openapi.trade.TradeClientV2;
HttpApiConfig config = HttpApiConfig.builder()
.appKey("<your_app_key>")
.appSecret("<your_app_secret>")
.regionId("us")
.endpoint("<api_endpoint>")
.build();
TradeClientV2 client = new TradeClientV2(config);
String accountId = "<your_account_id>";
var balanceInfo = client.balanceAccount(accountId);
System.out.println("Balance: " + balanceInfo);
Query Account Positions
- Python
- Java
res = trade_client.account_v2.get_account_position(account_id)
if res.status_code == 200:
print("Positions:", res.json())
var positions = client.positionsAccount(accountId);
System.out.println("Positions: " + positions);
What's Next
- Orders — Place and manage orders using your Account ID