# 历史订单

`GET` `/v1/trade/order/history`

该接口用于获取历史订单。

## Parameters

### Query Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `symbol` | string | No | 股票代码，使用 `ticker.region` 格式，例如：`AAPL.US` |
| `status` | array | No | 订单状态。可选值：`NotReported`、`ReplacedNotReported`、`ProtectedNotReported`、`VarietiesNotReported`、`DelayedNotReported`、`FilledStatus`、`WaitToNew`、`NewStatus`、`WaitToReplace`、`PendingReplaceStatus`、`ReplacedStatus`、`PartialFilledStatus`、`WaitToCancel`、`PendingCancelStatus`、`RejectedStatus`、`CanceledStatus`、`ExpiredStatus`、`PartialWithdrawal`。. 例如：`status=FilledStatus&status=NewStatus` |
| `side` | string | No | 买卖方向。**可选值：**, `Buy` - 买入，`Sell` - 卖出 |
| `market` | string | No | 市场。**可选值：**, `US` - 美股，`HK` - 港股 |
| `start_at` | string | No | 开始时间，格式为时间戳 (秒)，例如：`1650410999`。. 开始时间为空时，默认为结束时间或当前时间前九十天。 |
| `end_at` | string | No | 结束时间，格式为时间戳 (秒)，例如：`1650410999`。. 结束时间为空时，默认为开始时间后九十天或当前时间。 |

## Request Example

```bash
curl --request GET \
  --url 'https://openapi.longbridge.com/v1/trade/order/history' \
  --header 'Authorization: Bearer <access_token>'
```

## Response

### Response Properties

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `orders` | object[] | No | 订单信息 |
| `└ order_id` | string | No | 订单 ID |
| `└ status` | string | No | 订单状态。可选值：`NotReported`、`ReplacedNotReported`、`ProtectedNotReported`、`VarietiesNotReported`、`DelayedNotReported`、`FilledStatus`、`WaitToNew`、`NewStatus`、`WaitToReplace`、`PendingReplaceStatus`、`ReplacedStatus`、`PartialFilledStatus`、`WaitToCancel`、`PendingCancelStatus`、`RejectedStatus`、`CanceledStatus`、`ExpiredStatus`、`PartialWithdrawal`。 |
| `└ stock_name` | string | No | 股票名称 |
| `└ quantity` | string | No | 下单数量 |
| `└ executed_quantity` | string | No | 成交数量。. 当订单未成交时为 0 |
| `└ price` | string | No | 下单价格。. 当市价条件单未触发时为空字符串 |
| `└ executed_price` | string | No | 成交价。. 当订单未成交时为 0 |
| `└ submitted_at` | string | No | 下单时间 |
| `└ side` | string | No | 买卖方向。**可选值：**, `Buy` - 买入，`Sell` - 卖出 |
| `└ symbol` | string | No | 股票代码，使用 `ticker.region` 格式，例如：`AAPL.US` |
| `└ order_type` | string | No | 订单类型。可选值：`LO`、`ELO`、`MO`、`AO`、`ALO`、`ODD`、`LIT`、`MIT`、`TSLPAMT`、`TSLPPCT`、`SLO`。 |
| `└ trigger_price` | string | No | `LIT` / `MIT` 订单触发价格。. 当订单不是 `LIT` / `MIT` 订单为空字符串 |
| `└ tag` | string | No | 订单标记。**可选值：**, `Normal` - 普通订单，`Gtc` - 长期单，`Grey` - 暗盘单 |
| `└ time_in_force` | string | No | 订单有效期类型。**可选值：**, `Day` - 当日有效，`GTC` - 撤单前有效，`GTD` - 到期前有效 |
| `└ expire_date` | string | No | 长期单过期时间，格式为 `YYYY-MM-DD`, 例如：`2022-12-05。. 不是长期单时，默认为空字符串。` |
| `└ updated_at` | string | No | 最近更新时间，格式为时间戳 (秒)，默认为 0。 |
| `└ trigger_at` | string | No | 条件单触发时间，格式为时间戳 (秒)，默认为 0。 |
| `└ trigger_status` | string | No | 条件单触发状态，当订单不是条件单或条件单未触发时，触发状态为 NOT_USED. **可选值：**, `NOT_USED` - 未激活 `DEACTIVE` - 已失效 `ACTIVE` - 已激活 `RELEASED` - 已触发 |
| `└ outside_rth` | string | No | 是否允许盘前盘后，当订单不是美股时，默认为 UnknownOutsideRth. **可选值：**, `RTH_ONLY` - 不允许盘前盘后，`ANY_TIME` - 允许盘前盘后，`OVERNIGHT` - 夜盘" |
| `└ currency` | string | No | 结算货币 |
| `└ limit_depth_level` | integer | No | 指定买卖档位 |
| `└ trigger_count` | integer | No | 触发次数 |
| `└ trigger_qty_type` | integer | No | 触发数量类型。 |
| `└ attached_orders` | array | No | 附加订单详情列表 |
| `└ last_done` | string | No | 最近成交价格。. 当订单未成交时为空字符串 |
| `└ msg` | string | No | 拒绝信息或备注，默认为空字符串。 |
| `└ trailing_amount` | string | No | `TSLPAMT` 订单跟踪金额。. 当订单不是 `TSLPAMT` 订单时为空字符串。 |
| `└ trailing_percent` | string | No | `TSLPPCT` 订单跟踪涨跌幅。. 当订单不是 `TSLPPCT` 订单时为空字符串。 |
| `└ limit_offset` | string | No | `TSLPAMT` / `TSLPPCT` 订单指定价差。. 当订单不是 `TSLPAMT` / `TSLPPCT` 订单时为空字符串。 |
| `└ remark` | string | No | 备注 |
| `└ monitor_price` | string | No | 监控价格 |
| `└ monitor_counter_id` | string | No | 监控标的内部标识（条件单）。 |
| `└ multi_leg` | string | No | 多腿策略信息，仅多腿期权组合订单返回，非组合订单不返回。 |
| `has_more` | boolean | No | 是否还有更多数据。. 每次查询最大订单数量为 1000，如果查询结果数量超过 1000，那么 has_more 就会为 true |

### Response JSON Example

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "orders": [
      {
        "currency": "HKD",
        "executed_price": "0.000",
        "executed_quantity": "0",
        "expire_date": "",
        "last_done": "",
        "limit_offset": "",
        "msg": "",
        "order_id": "706388312699592704",
        "order_type": "ELO",
        "outside_rth": "UnknownOutsideRth",
        "price": "11.900",
        "quantity": "200",
        "side": "Buy",
        "status": "RejectedStatus",
        "stock_name": "Bank of East Asia Ltd/The",
        "submitted_at": "1651644897",
        "symbol": "23.HK",
        "tag": "Normal",
        "time_in_force": "Day",
        "trailing_amount": "",
        "trailing_percent": "",
        "trigger_at": "0",
        "trigger_price": "",
        "trigger_status": "NOT_USED",
        "updated_at": "1651644898",
        "remark": "",
        "limit_depth_level": 0,
        "monitor_price": "",
        "trigger_count": 1,
        "attached_orders": [
          {
            "order_id": "706388312699592705",
            "attached_type_display": 2,
            "trigger_price": "10.500",
            "quantity": "200",
            "executed_qty": "0",
            "status": "NewStatus",
            "updated_at": "1651644898",
            "withdrawn": false,
            "gtd": "",
            "time_in_force": "Day",
            "counter_id": "",
            "trigger_status": 0,
            "executed_amount": "0",
            "tag": 0,
            "submitted_at": "1651644897",
            "executed_price": "0.000",
            "force_only_rth": "RTH_ONLY",
            "reviewed": false,
            "activate_order_type": "MIT",
            "activate_rth": "RTH_ONLY",
            "submit_price": ""
          }
        ],
        "multi_leg": {
          "strategy": "2",
          "strategy_name": "Vertical spread",
          "multileg_id": "Spread_QQQ20260731C764/767",
          "code": "QQQ 260731 764/767 Vertical spread",
          "legs": [
            {
              "symbol": "QQQ260731C764000.US",
              "side": "Buy",
              "position": "LONG",
              "ratio_quantity": "1",
              "strike_price": "764",
              "expire_date": "20260731",
              "contract_direction": "C"
            },
            {
              "symbol": "QQQ260731C767000.US",
              "side": "Sell",
              "position": "SHORT",
              "ratio_quantity": "1",
              "strike_price": "767",
              "expire_date": "20260731",
              "contract_direction": "C"
            }
          ]
        }
      }
    ]
  }
}
```
