跳到主要内容

修改订单

接口说明

  • 功能说明:修改订单。

  • 注意事项:修改订单前必须已经成功调用了下单接口。

  • 适用对象:通过OpenAPI开发平台对接webull的客户。

  • 请求URL:/trade/order/replace

  • 请求方式:POST

  • 频次限制:每个App ID调用频次限制为1秒1次。

请求参数

注:只允许修改数量和价格(不需修改的数量与价格字段则传原值),其他参数需与原订单相同,需传但不能改

参数类型是否必填描述示例值
account_idString账户id20150320010101001
stock_order{}stock_order股票下单参数见示例代码

stock_order:

参数类型是否必填描述示例值
client_order_idString自定义订单ID,必须与原订单值相同2022021819071234
sideString买卖方向,必须与原订单值相同BUY
tifString订单有效期,必须与原订单值相同DAY
extended_hours_tradingBoolean是否允许盘前盘后交易,必须与原订单值相同false
instrument_idString资产标的ID,必须与原订单值相同913256135
order_typeString订单类型 ,必须与原订单值相同MARKET
limit_priceString限价价格,必须>0

LIMIT / STOP_LOSS_LIMIT必填
MARKET / STOP_LOSS / TRAILING_STOP_LOSS不能填值
100.49
qtyString下单数量,必须为正整数,最大值为200000股100
stop_priceString止损价格,必须>0

STOP_LOSS / STOP_LOSS_LIMIT / TRAILING_STOP_LOSS必填
LIMIT / MARKET不能填值
100.49
trailing_typeString追踪类型

TRAILING_STOP_LOSS必填
LIMIT / MARKET / STOP_LOSS / STOP_LOSS_LIMIT不能填值
AMOUNT
trailing_stop_stepString跟踪止损单的价差数值

TRAILING_STOP_LOSS必填
LIMIT / MARKET / STOP_LOSS / STOP_LOSS_LIMIT不能填值
100.49

响应参数

参数类型描述示例值
client_order_idString第三方订单ID2022021819071234

请求示例

限价单

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.US.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)
if response.status_code == 200:
order_res = response.json()

市价单

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.US.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)
if response.status_code == 200:
order_res = response.json()

止损单

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.US.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, stop_price=stop_price)
if response.status_code == 200:
order_res = response.json()

止损限价单

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.US.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)
if response.status_code == 200:
order_res = response.json()

跟踪止损单

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.US.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, stop_price=stop_price, trailing_type=trailing_type,trailing_stop_step = trailing_stop_step)
if response.status_code == 200:
order_res = response.json()

响应示例

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

异常示例

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