Skip to main content

Replace Order

Interface Description

  • Function description: Modify order.

  • Note: The order interface must be successfully called before modifying the order.

  • Applicable objects: Customers who connect to Webull through the OpenApi development platform.

  • Request URL: /trade/order/replace

  • Request method: POST

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

Request Parameters

Note: Only the quantity and price are allowed to be modified (the original value will be passed to the quantity and price fields that do not need to be modified). Other parameters must be the same as the original order, which needs to be passed but cannot be changed.

ParameterTypeRequired fieldsDescriptionExample value
account_idStringYesAccount ID20150320010101001
stock_order{}stock_orderYesStock order parametersSee example codes

stock_order:

ParameterTypeRequired fieldsDescriptionExample value
client_order_idStringYesThe third-party order ID is unique with the account ID. The maximum length of the input parameter in this field is 40. It must be passed and cannot be modified.2022021819071234
sideStringYesReferring to the dictionary value OrderSide, we currently only supports BUY and SELL, which must be passed and cannot be modified.BUY
tifStringYesThe validity period of the order, refer to the dictionary value OrderTIF, currently only DAY is supported, must be passed and cannot be modifiedDAY
extended_hours_tradingBooleanYesWhether to allow pre-market and post-market trading. The market order can only be false; the limit order can be true or false, and must not be modified.false
instrument_idStringYesThe ID of the equity which the caller obtains by calling Get Instruments must be passed and modification is not allowed.12064446
order_typeStringYesOrder type must be passed and not allowed to be modified referring to the dictionary value OrderType.MARKET
limit_priceStringNoIt needs to be passed for order_type of LIMIT (limit order), STOP_LOSS_LIMIT (stop-loss limit order), ENHANCED_LIMIT (enhanced limit order), AT_AUCTION_LIMIT (at-auction limit order). If it is not modified, it will carry the original value, and if it needs to be modified, the modified value will be passed.100.49
qtyStringYesThe number of equities should be an integer, and the maximum value supported is 1,000,000 shares. The original value will be taken without modification, and the modified value will be passed if modification is required.100
stop_priceStringNoWhen order_type is STOP_LOSS (stop-loss order), STOP_LOSS_LIMIT (stop-loss limit price), it needs to be passed, and the original value will be passed if it does not need to be modified, and the modified value will be passed if it needs to be modified.100.49
trailing_typeStringNoModifications are not allowed for spread type of trailing stop order referring to TrailingType , and trailing stop orders have to be transmitted.AMOUNT
trailing_stop_stepStringNoThe value of the price difference of the trailing stop order, the trailing stop order should be transmitted, and the original value will be carried if it does not need to be modified, and the modified value will be transmitted if it needs to be modified.100.49

Response Parameter

ParameterTypeDescriptionExample value
client_order_idStringThe 3rd party order ID2022021819071234

Request Example

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.replace_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()

Response Example

{
"code": 200,
"msg": "ok",
"data": {
"client_order_id": "01916462123512190"
}
}

Exception Example

{
"error_code": "TRADE_WEBULL_REQUEST_PROCESSING",
"message": "The order is processing, please try later"
}