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."
}