Skip to main content

Preview Options

Interface description

  • Function Description: Calculate the estimated amount and cost of options orders according to the incoming information.

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

  • Request method: POST

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

Parameters

ParameterTypeRequiredDescriptionExample value
account_idStringRequiredAccount ID2847483
new_orders[]order_itemRequiredOrder Details

order_item:

ParameterTypeRequiredDescriptionExample value
client_order_idStringRequiredOrder ID0KGOHL4PR2SLC0DKIND4TI0002
combo_typeStringRequiredComboType
Only NORMAL is supported.
NORMAL
option_strategyStringRequiredOptionsStrategy
Only SINGLE is supported.
SINGLE
sideStringRequiredOrderSide
Only BUY and SELL are supported.
BUY
order_typeStringRequiredOrder type refers to the dictionary value OrderType.
Only LIMIT,STOP_LOSS,STOP_LOSS_LIMIT are supported.
LIMIT
time_in_forceStringRequiredOrderTIFDAY
stop_priceStringOptionalStop loss price11.00
limit_priceStringOptionalLimited price11.00
quantityStringRequiredQuantity1
entrust_typeStringRequiredEntrustType
Currently, only QTY is supported
QTY
current_askStringRequiredThe current selling price seen by the user11.01
current_bidStringRequiredThe current buying price seen by the user11.00
orders[]orderRequiredLeg detail

order

ParameterTypeRequiredDescriptionExample value
sideStringRequiredOrderSide
Only BUY and SELL are supported.
BUY
quantityStringRequiredQuantity1
marketStringRequiredMarketsUS
instrument_typeStringRequiredInstrumentTypesOPTION
symbolStringRequiredSymbolAAPL
strike_priceStringOptionalExercise Price11.00
init_exp_dateStringOptionalExpiration date
Format: yyyy-MM-dd
2023-08-01
option_typeStringOptionalOptionsTypeCALL

Response

ParameterTypeDescriptionExample value
estimated_costStringEstimated Cost100.00
estimated_transaction_feeStringEstimated Transaction Fee1.00
currencyStringCurrencyUSD

Request Example

Single-leg Options

from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region

client_order_id = uuid.uuid4().hex
option_new_orders = [
{
"client_order_id": client_order_id,
"combo_type": "NORMAL",
"order_type": "LIMIT",
"quantity": "1",
"limit_price": "11.25",
"option_strategy": "SINGLE",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY",
"orders": [
{
"side": "BUY",
"quantity": "1",
"symbol": "AAPL",
"strike_price": "250.0",
"init_exp_date": "2024-12-27",
"instrument_type": "OPTION",
"option_type": "CALL",
"market": "US"
}
]
}
]

api_client = ApiClient(your_app_key, your_app_secret, Region.HK.value)
api = API(api_client)
response = api.order.preview_option(account_id, option_new_orders)
if response.status_code == 200:
order_res = response.json()

Response Example

Exception Example