Skip to main content

Preview Order(v2)

Interface description

  • Function description: Calculate the estimated amount and cost based on the incoming information, and support simple orders.

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

  • Request URL: /openapi/account/orders/preview?account_id={account_id}

  • Request method: POST

  • Frequency limit: The calling frequency of each AppId is limited to 2 time per second.

Parameters

ParameterTypeRequiredDescriptionValues/Example
account_idStringRequiredAccount IDCASH_10004248
new_orders[]order_itemRequiredOrder Details

order_item:

ParameterTypeRequiredDescriptionValues/Example
instrument_typeStringRequiredInstrument TypesEQUITY
symbolStringRequiredSymbolAAPL
marketStringRequiredmarketAAPL
sideStringRequiredSideBUY
order_typeStringRequiredOrder TypesMARKET
stop_priceStringOptionalStop 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_priceStringOptionalLimited 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
quantityStringRequiredQuantity1
support_trading_sessionStringRequiredTrading HoursN
entrust_typeStringRequiredEntrust Type
Currently, only QTY is supported
QTY
time_in_forceStringRequiredTime In ForceDAY
account_tax_typeStringRequiredAccount Tax TypeGENERAL
margin_typeStringOptionalMargin 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[]CloseContractOptionalList 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:

ParameterTypeRequiredDescriptionValues/Example
contract_idStringOptionalContract id2022021819071234
quantityStringOptionalThe quantities of orders to be closed under each contract ID.10

Response

ParameterTypeRequiredDescriptionValues/Example
estimated_costStringRequiredEstimated Cost100
estimated_transaction_feeStringRequiredEstimated Transaction Fee1

Request example

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)
preview_orders = {
"symbol": "7011",
"instrument_type": "EQUITY",
"market": "JP",
"order_type": "LIMIT",
"limit_price": "2070",
"quantity": "100",
"support_trading_session": "N",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"account_tax_type": "GENERAL"
}
res = api.order_v2.preview_order(account_id=account_id, preview_orders=preview_orders)
if res.status_code == 200:
print("preview_res=" + json.dumps(res.json(), indent=4))

Response

Exception example