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
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
account_id | String | Yes | Account ID | 20150320010101001 |
stock_order | {}stock_order | Yes | Stock Order Parameters | See example codes |
stock_order:
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
client_order_id | String | Yes | User-defined order ID. The maximum length is 40 and cannot be repeated. | 27290e2404e84572b2ffa0f89906525d |
side | String | Yes | Order side | BUY |
tif | String | Yes | Time-in-force: the validity period of the order. Reference OrderTIF. | DAY |
extended_hours_trading | Boolean | Yes | Extraded-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_id | String | Yes | Unique identifier for the security, obtained by calling the query from Get Instrument. | 913256135 |
order_type | String | Yes | Order type | MARKET |
limit_price | String | No | Limit 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 |
qty | String | Yes | Order quantity. Must be a positive integer and the maximum value is 200000 shares. | 100 |
stop_price | String | No | Stop 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_type | String | No | Trailing type Required for TRAILING_STOP_LOSS orders.It should not be passed for LIMIT / MARKET / STOP_LOSS / STOP_LOSS_LIMIT orders. | AMOUNT |
trailing_stop_step | String | No | The 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
Parameter | Type | Description | Example value |
---|---|---|---|
client_order_id | String | User-defined order ID | 2022021819071234 |
Request Example
Notes:
- 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.
- 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.
- Python
- Java
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()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
StockOrder stockOrder = new StockOrder();
stockOrder.setClientOrderId(clientOrderId);
stockOrder.setSide(side);
stockOrder.setTif(tif);
stockOrder.setExtendedHoursTrading(extendedHoursTrading);
stockOrder.setInstrumentId(instrumentId);
stockOrder.setOrderType(orderType);
stockOrder.setLimitPrice(limitPrice);
stockOrder.setQty(qty);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);
Market Order
- Python
- Java
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()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
StockOrder stockOrder = new StockOrder();
stockOrder.setClientOrderId(clientOrderId);
stockOrder.setSide(side);
stockOrder.setTif(tif);
stockOrder.setExtendedHoursTrading(extendedHoursTrading);
stockOrder.setInstrumentId(instrumentId);
stockOrder.setOrderType(orderType);
stockOrder.setQty(qty);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);
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.
- Python
- Java
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()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
StockOrder stockOrder = new StockOrder();
stockOrder.setClientOrderId(clientOrderId);
stockOrder.setSide(side);
stockOrder.setTif(tif);
stockOrder.setExtendedHoursTrading(extendedHoursTrading);
stockOrder.setInstrumentId(instrumentId);
stockOrder.setOrderType(orderType);
stockOrder.setQty(qty);
stockOrder.setStopPrice(stopPrice);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);
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.
- Python
- Java
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()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
StockOrder stockOrder = new StockOrder();
stockOrder.setClientOrderId(clientOrderId);
stockOrder.setSide(side);
stockOrder.setTif(tif);
stockOrder.setExtendedHoursTrading(extendedHoursTrading);
stockOrder.setInstrumentId(instrumentId);
stockOrder.setOrderType(orderType);
stockOrder.setQty(qty);
stockOrder.setLimitPrice(limitPrice);
stockOrder.setStopPrice(stopPrice);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);
Trailing Stop Order
Notes:
- 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.
- 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.
- Python
- Java
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()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
StockOrder stockOrder = new StockOrder();
stockOrder.setClientOrderId(clientOrderId);
stockOrder.setSide(side);
stockOrder.setTif(tif);
stockOrder.setExtendedHoursTrading(extendedHoursTrading);
stockOrder.setInstrumentId(instrumentId);
stockOrder.setOrderType(orderType);
stockOrder.setQty(qty);
stockOrder.setStopPrice(stopPrice);
stockOrder.setTrailingType(trailingType);
stockOrder.setTrailingStopStep(trailingStopStep);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);