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 AppId is limited to 2 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 |
---|---|---|---|---|
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, GTC. referring to the dictionary value OrderTIF. | DAY |
extended_hours_trading | Boolean | Yes | Whether to allow US pre-market and US post-market trading. Only availalbe for cash account. | false |
instrument_id | String | Yes | The caller obtains the symbol ID by calling Get Instruments. | 913256135 |
order_type | String | Yes | Order type refers to the dictionary value OrderType | MARKET |
limit_price | String | No | Order_type is LIMIT, STOP_LOSS_LIMIT needs to be passed. | 100.49 |
qty | String | No | Order quantity. Must be a positive integer and the maximum value is 200000 shares. It is not needed when closing a position according to the contract. | 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 |
trade_currency | String | Yes | Trade currency, USD only | USD |
account_tax_type | String | Yes | Account tax type refers to the dictionary value AccountTaxType | GENERAL |
margin_type | String | No | Margin type, refers to the dictionary value MarginType. When the specified contract is closed, the marginType of the contract must be the same type. Get the marginType type reference of the contract: Account Position. For margin account only. | ONE_DAY |
close_contracts | []CloseContract | No | List of contracts, if the position is closed with the field passed in (with a maximum of 10 contracts), the position will be closed according to the contract dimension. If contract id is not passed, the position will be closed according to the first-in-first-out rule. For margin account only. |
close_contracts:
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
contract_id | String | No | Contract id | 2022021819071234 |
qty | String | No | The quantities of orders to be closed under each contract ID. | 10 |
Response parameter
Parameter | Type | Description | Example value |
---|---|---|---|
client_order_id | String | WEBULL system internal orderId | 0324QQJAAS6DU0KHJQ2K000000 |
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.JP.value)
api = API(api_client)
stock_order = {
"client_order_id": "2343512312312312",
"instrument_id": "913255598",
"side": "SELL",
"tif": "DAY",
"order_type": "LIMIT",
"limit_price": "485.100",
"extended_hours_trading": False,
"trade_currency": "USD",
"account_tax_type": "GENERAL",
"margin_type": "ONE_DAY",
"close_contracts": [
{
"contract_id": "MCH6VT35A9OFA4DVNOBGEE98JA",
"qty": "2"
}
]
}
response = api.order.place_order_v2(account_id, stock_order)
if response.status_code == 200:
order_res = response.json()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.jp.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
StockOrder stockOrder = new StockOrder();
stockOrder.setContractId(contractId);
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.setTradeCurrency(tradeCurrency);
stockOrder.setAccountTaxType(accountTaxType);
stockOrder.setMarginType(marginType);
stockOrder.setCloseContract(closeContract);
OrderResponse orderResponse = apiService.placeOrder(accountId, stockOrder);