Skip to content

下單 ​

POST /api/v1.0/sim-trade/{acc_id}/orders

模擬交易下單。限價單必須傳入 price;數量和價格均使用字串。

請求參數 ​

參數類型位置必填說明
acc_idstringpath是業務賬戶 ID
marketintbody是市場(來自賬戶列表的 market_id)
symbolstringbody是證券代碼
order_typeintbody是1=限價 3=市價
order_sideintbody是1=買 2=賣 3=賣空 4=買回
qtystringbody是數量
pricestringbody否價格(限價必填)
textstringbody否備註(≤100 字節)
order_trade_time_typeintbody否交易時段:0=未設定,1=僅盤中,2=包括盤前盤後(美股兩融賬戶支援)

請求示例 ​

bash
curl -s -X POST "https://webapi.moomoo.com/api/v1.0/sim-trade/80303779/orders" \
  -H "Authorization: Bearer <AccessToken>" \
  -H "Content-Type: application/json" \
  -d '{"market":1,"symbol":"00700","order_type":1,"order_side":1,"qty":"100","price":"400"}' | jq

響應欄位 ​

欄位類型說明
order_idint64訂單 ID

響應示例 ​

json
{
  "ret_code": 0,
  "ret_msg": "success",
  "data": {
    "order_id": 1270777
  }
}

錯誤響應 ​

HTTP 狀態仍為 200。請求失敗時返回非 0 的 ret_code 和 error 物件。

json
{
  "ret_code": -3,
  "ret_msg": "invalid request",
  "error": {"code": "invalid_parameter", "message": "invalid request"}
}