Skip to main content

Place Order

Interface Description

  • Function description: This interface is used by eligible customers to place orders (of U.S. stocks and U.S. ETFs only)

  • Applicable objects: Customers who integrate into Webull through Webull OpenAPI.

  • Request URL: /trade/order/place

  • Request method: POST

  • Frequency limit: The calling frequency of each App ID is limited to 1 time per second.

Request Parameters

ParameterTypeRequired fieldsDescriptionExample value
account_idStringYesAccount ID20150320010101001
stock_order{}stock_orderYesStock Order ParametersSee example codes

stock_order:

ParameterTypeRequired fieldsDescriptionExample value
client_order_idStringYesUser-defined order ID. The maximum length is 40 and cannot be repeated.27290e2404e84572b2ffa0f89906525d
sideStringYesOrder sideBUY
tifStringYesTime-in-force: the validity period of the order. Reference OrderTIF.DAY
extended_hours_tradingBooleanYesExtraded-hours trading

Optional values:
true - Extraded-hours trading (only support true when the order type is LIMIT)
false - do not allow trading in extended hours.
false
instrument_idStringYesUnique identifier for the security, obtained by calling the query from Get Instrument.913256135
order_typeStringYesOrder typeMARKET
limit_priceStringNoLimit price. Must be >0

Required for LIMIT / STOP_LOSS_LIMIT orders.
It should not be passed for MARKET / STOP_LOSS / TRAILING_STOP_LOSS orders.
100.49
qtyStringYesOrder quantity. Must be a positive integer and the maximum value is 200000 shares.100
stop_priceStringNoStop loss price. Must be >0

Required for STOP_LOSS / STOP_LOSS_LIMIT / TRAILING_STOP_LOSS orders.
It should not be passed for LIMIT / MARKET orders.
100.49
trailing_typeStringNoTrailing type

Required for TRAILING_STOP_LOSS orders.
It should not be passed for LIMIT / MARKET / STOP_LOSS / STOP_LOSS_LIMIT orders.
AMOUNT
trailing_stop_stepStringNoThe value of the spread for trailing stop orders.

Required for TRAILING_STOP_LOSS orders.
It should not be passed for LIMIT / MARKET / STOP_LOSS / STOP_LOSS_LIMIT orders.
100.49

Response Parameter

ParameterTypeDescriptionExample value
client_order_idStringUser-defined order ID2022021819071234

Request Example

Notes:

  1. Quantity: If the price is between $0.01 and $0.099, the minimum is 1000 shares. If the price is between $0.1 and $1, the minimum is 100 shares. If the price is greater than $1, the minimum is 1 share. If the price is less than $0.01, only liquidation is supported, and you cannot place any orders.
  2. Price: If the price is greater than $1, the minimum step size is 0.01. If it's less than $1, the minimum step size is 0.0001.

Limit Order

Note:
Limit price: if the limit price is greater than $1, the minimum step size is 0.01. If it's less than $1, the minimum step size is 0.0001.

from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.order.place_order(account_id, qty, instrument_id, side, client_order_id, order_type,
extended_hours_trading, tif, limit_price)
if response.status_code == 200:
order_res = response.json()

Market Order

from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.order.place_order(account_id, qty, instrument_id, side, client_order_id, order_type,
extended_hours_trading, tif)
if response.status_code == 200:
order_res = response.json()

Stop Order

Note:
Stop price: For buy orders, the stop loss price must be greater than the current latest price.For sell orders, the stop price must be less than the current last price.

from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.order.place_order(account_id, qty, instrument_id, side, client_order_id, order_type,
extended_hours_trading, tif, stop_price=stop_price)
if response.status_code == 200:
order_res = response.json()

Stop Limit Order

Notes:
Stop price: For buy orders, the stop loss price must be greater than the current latest price.For sell orders, the stop price must be less than the current last price.
Limit price: For a buy order, the limit price must be greater than the stop price.For a sell order, the limit price must be less than stop price.

from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.order.place_order(account_id, qty, instrument_id, side, client_order_id, order_type,
extended_hours_trading, tif, limit_price, stop_price)
if response.status_code == 200:
order_res = response.json()

Trailing Stop Order

Notes:

  1. The default step size of the percentage is 1%, and the input of 20 actually corresponds to 20%; when trailing_type is PERCENTAGE, the value is >=1%, and it is an integer.
  2. Decimals of price difference when trailing_type is AMOUNT:Trailing spread >= $1, the minimum step is 0.01.Trailing spread < $1, minimum step is 0.0001.
from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.order.place_order(account_id, qty, instrument_id, side, client_order_id, order_type,
extended_hours_trading, tif, stop_price=stop_price, trailing_type=trailing_type,trailing_stop_step=trailing_stop_step)
if response.status_code == 200:
order_res = response.json()

Response Example

{
"code": 200,
"msg": "ok",
"data": {
"client_order_id": "01916462123512190"
}
}

Exception Example

{
"error_code": "TRADE_PLACE_ORDER_REPEAT",
"message": "The order existed"
}