Skip to main content

Orders

Webull’s Orders API enables developers to trade and query over HTTP. For more details, please refer to the API Reference.

Before calling the Trading API, you need to have an App Key and secret. For more information, please refer to the Individual Application Process.

1. Supported Markets

The Trading API supports the following markets:

MarketProducts
United StatesUS equity products (stocks, options)
Futures
Cryptocurrencies

2. Base URLs

  • Production Environment: https://api.webull.com/
  • Test Environment: http://us-openapi-alb.uat.webullbroker.com/

3. Code Example

3.1 Stock Orders

Parameters for Order Types

{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<client_order_id>",
"instrument_type": "EQUITY",
"symbol": "BULL",
"market": "US",
"side": "BUY",
"order_type": "LIMIT",
"limit_price": "11.0",
"quantity": "1",
"support_trading_session": "CORE",
"entrust_type": "QTY",
"time_in_force": "DAY",
"combo_type": "NORMAL"
}
]
}

SDK Examples

import uuid
from webull.core.client import ApiClient
from webull.trade.trade_client import TradeClient

optional_api_endpoint = "<webull_api_host>" # PRD env host: api.webull.com; Test env host: us-openapi-alb.uat.webullbroker.com
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
region_id = "us"
account_id = "<your_account_id>" # Use account_list interface to get account info
api_client = ApiClient(your_app_key, your_app_secret, region_id)
api_client.add_endpoint(region_id, optional_api_endpoint)


if __name__ == '__main__':
trade_client = TradeClient(api_client)


# simple order
client_order_id = uuid.uuid4().hex
print('client order id:', client_order_id)
new_simple_orders = [
{
"client_order_id": client_order_id,
"symbol": "BULL",
"instrument_type": "EQUITY",
"market": "US",
"order_type": "LIMIT",
"limit_price": "26",
"quantity": "1",
"support_trading_session": "CORE",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY"
}
]

res = trade_client.order_v2.preview_order(account_id, new_simple_orders)
if res.status_code == 200:
print('preview order res:', res.json())

res = trade_client.order_v2.place_order(account_id, new_simple_orders)
if res.status_code == 200:
print('place order res:', res.json())

modify_simple_orders = [
{
"client_order_id": client_order_id,
"quantity": "2",
"limit_price": "25"
}
]
res = trade_client.order_v2.replace_order(account_id, modify_simple_orders)
if res.status_code == 200:
print('replace order res:', res.json())

res = trade_client.order_v2.cancel_order(account_id, client_order_id)
if res.status_code == 200:
print('cancel order res:', res.json())

res = trade_client.order_v2.get_order_detail(account_id, client_order_id)
if res.status_code == 200:
print('order detail:', res.json())

3.2 Options Orders

Parameters for Order Types

{
"account_id": "<your_account_id>",
"new_orders": [
{
"client_order_id": "<client_order_id>",
"combo_type": "NORMAL",
"order_type": "LIMIT",
"quantity": "1",
"limit_price": "220.25",
"option_strategy": "SINGLE",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"legs": [
{
"side": "BUY",
"quantity": "1",
"symbol": "AAPL",
"strike_price": "220",
"init_exp_date": "2025-11-19",
"instrument_type": "OPTION",
"option_type": "CALL",
"market": "US"
}
]
}
]
}

SDK Examples

import uuid
from webull.core.client import ApiClient
from webull.trade.trade_client import TradeClient

optional_api_endpoint = "<webull_api_host>" # PRD env host: api.webull.com; Test env host: us-openapi-alb.uat.webullbroker.com
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
region_id = "us"
account_id = "<your_account_id>" # Use account_list interface to get account info
api_client = ApiClient(your_app_key, your_app_secret, region_id)
api_client.add_endpoint(region_id, optional_api_endpoint)

if __name__ == '__main__':
trade_client = TradeClient(api_client)

# Options
# For option order inquiries, please use the V2 query interface: api.order_v2.get_order_detail(account_id, client_order_id).
client_order_id = uuid.uuid4().hex
option_new_orders = [
{
"client_order_id": client_order_id,
"combo_type": "NORMAL",
"order_type": "LIMIT",
"quantity": "1",
"limit_price": "21.25",
"option_strategy": "SINGLE",
"side": "BUY",
"time_in_force": "GTC",
"entrust_type": "QTY",
"legs": [
{
"side": "BUY",
"quantity": "1",
"symbol": "TSLA",
"strike_price": "400",
"option_expire_date": "2025-11-26",
"instrument_type": "OPTION",
"option_type": "CALL",
"market": "US"
}
]
}
]

# preview
res = trade_client.order_v2.preview_option(account_id, option_new_orders)
if res.status_code == 200:
print("preview option res:", res.json())

# place
res = trade_client.order_v2.place_option(account_id, option_new_orders)
if res.status_code == 200:
print("place option res:" , res.json())

option_modify_orders = [
{
"client_order_id": client_order_id,
"quantity": "2",
"limit_price": "21.25"
}
]
res = trade_client.order_v2.replace_option(account_id, option_modify_orders)
if res.status_code == 200:
print("Replace option order res:" , res.json())

res = trade_client.order_v2.cancel_option(account_id, client_order_id)
if res.status_code == 200:
print("Replace option order res:" , res.json())

res = trade_client.order_v2.get_order_detail(account_id, client_order_id)
if res.status_code == 200:
print("Option order detail order res:" , res.json())

3.3 Futures Orders

Parameters for Order Types

3.4 Crypto Orders

SDK Examples

import uuid
from time import sleep

from webull.core.client import ApiClient
from webull.trade.trade_client import TradeClient

optional_api_endpoint = "<webull_api_host>" # PRD env host: api.webull.com; Test env host: us-openapi-alb.uat.webullbroker.com
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
region_id = "us"
account_id = "<your_account_id>" # Use account_list interface to get account info
api_client = ApiClient(your_app_key, your_app_secret, region_id)
api_client.add_endpoint(region_id, optional_api_endpoint)


if __name__ == '__main__':
trade_client = TradeClient(api_client)

# normal crypto order
normal_crypto_client_order_id = uuid.uuid4().hex
print('normal crypto client order id:', normal_crypto_client_order_id)
new_normal_crypto_orders = [
{
"combo_type": "NORMAL",
"client_order_id": normal_crypto_client_order_id,
"symbol": "BTCUSD",
"instrument_type": "CRYPTO",
"market": "US",
"order_type": "LIMIT",
"limit_price": "80000",
"quantity": "0.003",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY"
}
]

res = trade_client.order_v3.place_order(account_id, new_normal_crypto_orders)
if res.status_code == 200:
print('place normal crypto order res:', res.json())
sleep(3)

res = trade_client.order_v3.cancel_order(account_id, normal_crypto_client_order_id)
if res.status_code == 200:
print('cancel normal crypto order res:', res.json())

res = trade_client.order_v3.get_order_detail(account_id, normal_crypto_client_order_id)
if res.status_code == 200:
print('get normal crypto order detail res:', res.json())