Skip to content

歷史訂單 ​

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

獲取歷史訂單(支援時間範圍 + 分頁)。

請求參數 ​

參數類型位置必填說明
acc_idstringpath是業務賬戶 ID
marketintquery是賬戶市場ID(賬戶列表中該賬戶的 market_id,如 1=港股 100=美股融資融券),必須與 acc_id 對應賬戶一致
time_beginint64query否起始時間(Unix 微秒)
time_endint64query否結束時間(Unix 微秒)
page_sizeintquery否分頁大小(預設 50)
next_keystringquery否翻頁游標

請求示例 ​

bash
curl -s "https://webapi.moomoo.com/api/v1.0/sim-trade/80306537/history-orders?market=100&page_size=10" -H "Authorization: Bearer <AccessToken>" | jq

響應欄位 ​

訂單欄位同今日訂單,額外包含分頁資訊:pagination.has_more(bool)、pagination.next_key(string)。

響應示例 ​

json
{
  "ret_code": 0,
  "ret_msg": "success",
  "data": {
    "orders": [
      {
        "order_id": "1294505",
        "side": 1,
        "market": 2,
        "symbol": "AAPL",
        "stock_name": "Apple",
        "order_type": 1,
        "status": 5,
        "qty": "1",
        "cum_qty": "0",
        "price": "1",
        "avg_fill_price": "0",
        "aux_price": null,
        "time_in_force": 0,
        "order_trade_time_type": 1,
        "create_time": "1794192328000000",
        "update_time": "1794192328000000",
        "text": ""
      }
    ]
  },
  "pagination": {
    "next_key": "0",
    "has_more": false
  }
}

錯誤響應 ​

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

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