Place Order(v2)
Interface description
Function description: (Preferred use),Place equity orders, including simple orders.
Applicable objects: Customers who integrate into Webull through Webull OpenAPI
Request URL:
/openapi/account/orders/place?account_id={account_id}
Request method: POST
Frequency limit: The calling frequency of each AppId is limited to 2 time per second.
Parameters
Parameter | Type | Required | Description | Values/Example |
---|---|---|---|---|
account_id | String | Required | Account ID | 20150320010101001 |
new_orders | []order_item | Required | Order Details |
order_item:
Parameter | Type | Required | Description | Values/Example |
---|---|---|---|---|
instrument_type | String | Required | Instrument Types | EQUITY |
client_order_id | String | Optional | User-defined order ID. The maximum length is 32 and cannot be repeated. | 0KGOHL4PR2SLC0DKIND4TI0002 |
symbol | String | Required | Symbol | AAPL |
market | String | Required | market | AAPL |
side | String | Required | Side | BUY |
order_type | String | Required | Order Types | MARKET |
time_in_force | String | Required | Time In Force | DAY |
stop_price | String | Optional | Stop loss price When the market price is greater than or equal to 1, the precision is 2, and when the market price is less than 1, the precision is 4 | 11.00 |
limit_price | String | Optional | Limited price When the market price is greater than or equal to 1, the precision is 2, and when the market price is less than 1, the precision is 4 | 11.00 |
quantity | String | Required | Quantity | 1 |
entrust_type | String | Required | Entrust Type Currently, only QTY is supported | QTY |
support_trading_session | String | Required | Trading Hours | N |
account_tax_type | String | Required | Account Tax Type | GENERAL |
margin_type | String | Optional | 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. | ONE_DAY |
close_contracts | []CloseContract | Optional | 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. |
close_contracts:
Parameter | Type | Required | Description | Values/Example |
---|---|---|---|---|
contract_id | String | Optional | Contract id | 2022021819071234 |
quantity | String | Optional | The quantities of orders to be closed under each contract ID. | 10 |
Response
Parameter | Type | Required | Description | Values/Example |
---|---|---|---|---|
client_order_id | String | Required | Client Order id Simple order return. User-defined order ID | 0KGOHL4PR2SLC0DKIND4TI0002 |
order_id | String | Required | Order id Simple order return, Webull order ID. | 80HG7CPSFDPCAL3TP66LKBAS69 |
Request example
- python
- Java
from webullsdkcore.client import ApiClient
from webullsdktrade.api import API
api_client = ApiClient(your_app_key, your_app_secret, Region.JP.value)
api = API(api_client)
client_order_id = uuid.uuid4().hex
new_orders = {
"client_order_id": client_order_id,
"symbol": "7011",
"instrument_type": "EQUITY",
"market": "JP",
"order_type": "LIMIT",
"limit_price": "2080",
"quantity": "100",
"support_trading_session": "N",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"account_tax_type": "GENERAL"
}
res = api.order_v2.place_order(account_id=account_id, new_orders=new_orders)
if res.status_code == 200:
print("place_order_res=" + json.dumps(res.json(), indent=4))
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.jp.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
TradeOrder tradeOrder = new TradeOrder();
List<TradeOrderItem> newOrders = new ArrayList<>();
TradeOrderItem placeOne = new TradeOrderItem();
newOrders.add(placeOne);
placeOne.setSymbol(symbol);
placeOne.setInstrumentType(instrumentType);
placeOne.setMarket(market);
placeOne.setOrderType(orderType);
placeOne.setQuantity(quantity);
placeOne.setLimitPrice(limitPrice);
placeOne.setSupportTradingSession(supportTradingSession);
placeOne.setSide(side);
placeOne.setTimeInForce(timeInForce);
placeOne.setEntrustType(entrustType);
placeOne.setAccountTaxType(accountTaxType);
placeOne.setMarginType(marginType);
placeOne.setCloseContract(closeContract);
tradeOrder.setNewOrders(newOrders);
TradeOrderResponse tradePlaceOrderResponse = apiService.placeOrderV2(accountId, tradeOrder);