Skip to content

改单 ​

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_idstring是业务账户 ID。
order_idstring是订单 ID。

请求参数 ​

参数类型位置必填说明
exchangeexchange请求体是交易所。可选值参见命名词典 - exchange。
qtystring请求体是修改后的订单数量。期权和期货的单位为"合约"。
pricestring请求体否修改后的价格。期货账户精确到 9 位小数,外汇账户精确到 5 位小数,证券账户精确到 4 位小数,超出部分四舍五入。
aux_pricestring请求体否触发价格。当订单类型为 STOP、STOP_LIMIT、MARKET_IF_TOUCHED、LIMIT_IF_TOUCHED 时必填。期货账户精确到 9 位小数,外汇账户精确到 5 位小数,证券账户精确到 3 位小数,超出部分四舍五入。
trail_typetrail_type请求体否新跟踪止损类型(仅跟踪止损单)。
trail_valuestring请求体否新跟踪金额或百分比(仅跟踪止损单)。
trail_spreadstring请求体否新指定价差(仅 TRAILING_STOP_LIMIT)。
algo_infoalgo_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

响应参数 ​

字段类型说明
sstring请求结果。成功为 ok;失败为 error。
errcodeinteger错误码,仅失败时返回。
errmsgstring错误信息,仅失败时返回。
need_order_confirmboolean是否需要二次确认。
confirm_idstring二次确认 ID,用于调用「订单二次确认」接口。
jump_urlstring券商要求打开网页时的跳转 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"
}