Skip to content

獲取歷史訂單

GET /api/v1.0/accounts/{acc_id}/orders_history

查詢指定交易業務賬戶的歷史訂單列表。

路徑參數

參數類型必填說明
acc_idstring業務賬戶 ID。

請求參數

參數類型位置必填說明
trd_marketstring查詢交易市場。可選值參見 命名詞典
codestring查詢代碼篩選。返回指定代碼的數據,默認返回全部數據。
startuint64查詢創建時間的起始時間,時間戳,單位微秒。
enduint64查詢創建時間的結束時間,應在起始時間之後。時間戳,單位微秒。
page_flagstring查詢翻頁標記,首次請求填空字符串表示從頭開始,之後填入服務端返回的 page_flag。
page_sizeuint32查詢每頁條數,默認 50,取值範圍 10-100。

startend 的組合說明:

startend說明
>0>0startend 分別為指定日期。
0>0startend 之前 90 天。
>00endstart 之後 90 天。
00start 為當前日期之前 90 天,end 為當前日期。

響應參數

字段類型說明
orderslist[Order]訂單列表
page_flagstring下次請求的翻頁標記
completedbooltrue 表示所有訂單已返回,客戶端應停止翻頁請求。

響應示例

json
{
  "s": "ok",
  "d": {
    "orders": [
      {
        "side": "BUY",
        "order_type": "LIMIT",
        "order_status": "FILLED_ALL",
        "order_id": "2024030100000001",
        "code": "US.AAPL",
        "stock_name": "Apple Inc.",
        "security_type": "STOCK",
        "qty": "100",
        "price": "180.000",
        "currency": "USD",
        "create_time": 1709251200000000,
        "updated_time": 1709251210000000,
        "dealt_qty": "100",
        "dealt_avg_price": "180.000",
        "last_err_msg": "",
        "remark": "",
        "time_in_force": "DAY",
        "session": "RTH",
        "aux_price": "0.000",
        "trail_type": "NONE",
        "trail_value": "0.000",
        "trail_spread": "0.000"
      }
    ],
    "page_flag": "",
    "completed": true
  }
}

失敗響應:

json
{
  "s": "error",
  "errcode": -1200,
  "errmsg": "Error message."
}