改单
PUT/api/v1.0/accounts/{acc_id}/orders/{order_id}修改已有订单。
改单结果怎么看
s为error且need_order_confirm为true:还需确认(不是最终失败),用顶层confirm_id调用二次确认。- 有
jump_url:请在浏览器打开该链接继续。 - 这些字段在响应顶层,不在
d里。详见二次确认。
exchange 必填,请直接使用 获取未完成订单 或 获取订单详情 返回的值(例如港股常见为 SEHK),不要从标的代码(如 HK.00700)自行推断。部分成交后,新数量不能小于已成交数量。需要估算可改数量时,可先调 查询最大买卖数量 并传入 order_id。
路径参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
acc_id | string | 是 | 业务账户 ID。 |
order_id | string | 是 | 订单 ID。 |
请求参数
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
exchange | exchange | 请求体 | 是 | 交易所。可选值参见命名词典 - exchange。 |
qty | string | 请求体 | 是 | 修改后的订单数量。期权和期货的单位为"合约"。 |
price | string | 请求体 | 否 | 修改后的价格。期货账户精确到 9 位小数,外汇账户精确到 5 位小数,证券账户精确到 4 位小数,超出部分四舍五入。 |
aux_price | string | 请求体 | 否 | 触发价格。当订单类型为 STOP、STOP_LIMIT、MARKET_IF_TOUCHED、LIMIT_IF_TOUCHED 时必填。期货账户精确到 9 位小数,外汇账户精确到 5 位小数,证券账户精确到 3 位小数,超出部分四舍五入。 |
trail_type | trail_type | 请求体 | 否 | 新跟踪止损类型(仅跟踪止损单)。 |
trail_value | string | 请求体 | 否 | 新跟踪金额或百分比(仅跟踪止损单)。 |
trail_spread | string | 请求体 | 否 | 新指定价差(仅 TRAILING_STOP_LIMIT)。 |
algo_info | algo_info | 请求体 | 否 | 算法单参数。当原订单为算法单且需修改算法参数时填入,结构同响应 algo_info。 |
请求示例
bash
curl -X PUT 'https://webapi.moomoo.com/api/v1.0/accounts/{acc_id}/orders/{order_id}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <AccessToken>' \
-d '{
"exchange": "US",
"qty": "200",
"price": "155.00"
}' | jq响应参数
| 字段 | 类型 | 说明 |
|---|---|---|
s | string | 请求结果。成功为 ok;失败为 error。 |
errcode | integer | 错误码,仅失败时返回。 |
errmsg | string | 错误信息,仅失败时返回。 |
need_order_confirm | boolean | 是否需要二次确认。 |
confirm_id | string | 二次确认 ID,用于调用「订单二次确认」接口。 |
jump_url | string | 券商要求打开网页时的跳转 URL。 |
响应示例
json
{
"s": "ok"
}失败响应:
缺少必填参数 qty:
json
{
"s": "error",
"errcode": 485210001,
"errmsg": "invalid request body"
}业务错误:
json
{
"s": "error",
"errcode": 1013,
"errmsg": "Action failed. This order is partially filled. The new order quantity can't be less than the filled amount. Please adjust the quantity and try again.",
"need_order_confirm": false
}需要二次确认:
json
{
"s": "error",
"errcode": 108330261,
"errmsg": "Due to liquidity and market conditions, you may be unable to open or close positions for this security. Do you want to continue?",
"need_order_confirm": true,
"confirm_id": "0a1984f400616ae1b2100008eb430000"
}