Place Order
Interface Description
Function description: This interface is used by customers in Hong Kong to place orders, and supports placing orders in three markets: U.S Stocks, Hong Kong stocks, and A shares (China Connect).
Applicable objects: Customers who connect to webull through the OpenApi development platform.
Request URL: /trade/order/place
Request method: POST
Frequency limit: The calling frequency of each AppId 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 | Third-party order ID, and the maximum length of this field is 40. | 2022021819071234 |
side | String | Yes | Buy and sell direction support BUY, SELL, referring to the dictionary value OrderSide. | BUY |
tif | String | Yes | Order validity period supports DAY, referring to the dictionary value OrderTIF. | DAY |
extended_hours_trading | Boolean | Yes | Whether to allow pre-market and post-market trading. Market orders can only be false, and limit orders can be true or false. | false |
instrument_id | String | Yes | The caller obtains the symbol ID by calling Get Instruments. | 12064446 |
order_type | String | Yes | Order type refers to the dictionary value OrderType | MARKET |
limit_price | String | No | Order_type is LIMIT, STOP_LOSS_LIMIT, ENHANCED_LIMIT, AT_AUCTION_LIMIT (at-auction limit order) and needs to be passed. | 100.49 |
qty | String | Yes | The amount of the equities to place an order, integer, the maximum value supported is 1000000 shares | 100 |
stop_price | String | No | When order_type is STOP_LOSS (stop-loss order), STOP_LOSS_LIMIT (stop-loss limit price), it needs to pass | 100.49 |
trailing_type | String | No | Spread type of trailing stop order, trailing stop order to be transmitted, refer to TrailingType | AMOUNT |
trailing_stop_step | String | No | Spread value of trailing stop order, trailing stop order to be transmitted | 100.49 |
Response Parameter
Parameter | Type | Description | Example value |
---|---|---|---|
client_order_id | String | The 3rd party order ID | 2022021819071234 |
Request Example
- 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.HK.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,
trailing_type, 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.hk.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);
stockOrder.setStopPrice(stopPrice);
stockOrder.setTrailingType(trailingType);
stockOrder.setTrailingStopStep(trailingStopStep);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);