# 网格订单详情

`GET` `/v1/gridtrading/detail`

查询单个网格订单的完整详情，包括网格规则、分页的成交子订单（`grid_sub_orders`）以及分页的生命周期历史（`grid_order_history`）。

## Parameters

### Query Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `order_id` | string | Yes | 网格订单 ID，例如：`764609681686573056` |
| `history_id` | string | No | 生命周期历史的分页游标，传入某页最后一条的 `history_id` 以获取更早的记录 |
| `limit` | integer | No | `grid_sub_orders` 与 `grid_order_history` 的分页大小 |

## Request Example

```bash
curl --request GET \
  --url 'https://openapi.longbridge.com/v1/gridtrading/detail?order_id=<order_id>' \
  --header 'Authorization: Bearer <access_token>'
```

## Response

### Response Properties

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `order_id` | string | Yes | 网格订单 ID |
| `symbol` | string | Yes | 标的代码，`ticker.region` 格式 |
| `stock_name` | string | Yes | 标的名称 |
| `status` | string | Yes | 网格订单状态，例如：`Performing` / `Suspended` |
| `grid_status` | string | Yes | 网格详细运行状态 |
| `suspend_reason` | string | Yes | 网格被暂停的原因，运行中时为空 |
| `sleeping_reason` | string | Yes | 网格休眠的原因，活跃时为空 |
| `submitted_base_price` | string | Yes | 提交时网格锚定的基准价 |
| `current_base_price` | string | Yes | 触发后的当前基准价 |
| `upper_limit_price` | string | Yes | 价格上界 |
| `lower_limit_price` | string | Yes | 价格下界 |
| `trigger_price_type` | int32 | Yes | 触发阈值的计价方式。**枚举值：**, `1` - 价差（绝对值）, `2` - 百分比 |
| `trigger_spread_up` | string | Yes | 向上触发价差（当 `trigger_price_type` 为 `1` 时） |
| `trigger_spread_down` | string | Yes | 向下触发价差（当 `trigger_price_type` 为 `1` 时） |
| `trigger_percent_up` | string | Yes | 向上触发百分比（当 `trigger_price_type` 为 `2` 时） |
| `trigger_percent_down` | string | Yes | 向下触发百分比（当 `trigger_price_type` 为 `2` 时） |
| `pullback_percent` | string | Yes | 回落百分比 |
| `pullback_spread` | string | Yes | 回落价差 |
| `rebound_percent` | string | Yes | 反弹百分比 |
| `rebound_spread` | string | Yes | 反弹价差 |
| `multiple_trigger` | boolean | Yes | 单个网格档位是否可多次触发 |
| `time_in_force` | int32 | Yes | 订单有效期。**枚举值：**, `0` - 当日有效，`1` - GTC, `6` - GTD |
| `trigger_quantity` | string | Yes | 每次触发的数量 |
| `trigger_sell_quantity` | string | Yes | 卖出方向累计触发数量 |
| `trigger_buy_quantity` | string | Yes | 买入方向累计触发数量 |
| `upper_limit_quantity` | string | Yes | 触及上界时处理的数量 |
| `lower_limit_quantity` | string | Yes | 触及下界时处理的数量 |
| `upper_limit_event` | int32 | Yes | 触及上界时的动作。**枚举值：**, `1` - 忽略，`2` - 按最新价平仓 |
| `lower_limit_event` | int32 | Yes | 触及下界时的动作。**枚举值：**, `1` - 忽略，`2` - 按最新价平仓 |
| `trigger_sell_depth` | int32 | Yes | 卖出方向盘口深度（-5 ~ 5）。`0` = 使用 `grid_order_type_up` |
| `trigger_buy_depth` | int32 | Yes | 买入方向盘口深度（-5 ~ 5）。`0` = 使用 `grid_order_type_down` |
| `created_at` | string | Yes | 创建时间，RFC3339 格式 |
| `updated_at` | string | Yes | 最后更新时间，RFC3339 格式 |
| `settlement_currency` | string | Yes | 结算货币，例如：`HKD` |
| `expire_time` | string | Yes | 过期时间，RFC3339 格式（当 `time_in_force` 为 GTD 时） |
| `gtd` | string | Yes | Good-Til-Date，`YYYY-MM-DD` 格式 |
| `grid_sub_orders` | object[] | No | 该网格已成交的子订单 |
| `└ id` | string | Yes | 子订单 ID |
| `└ price` | string | Yes | 订单价格 |
| `└ order_type` | string | Yes | 订单类型 |
| `└ quantity` | string | Yes | 订单数量 |
| `└ executed_qty` | string | Yes | 已成交数量 |
| `└ action` | int32 | Yes | 买卖方向 |
| `└ status` | string | Yes | 子订单状态 |
| `└ submitted_at` | string | Yes | 提交时间，RFC3339 格式 |
| `└ rth` | int32 | Yes | 盘中交易时段标识（`0` / `1` / `2`） |
| `sub_has_more` | boolean | Yes | 是否还有更多子订单可分页 |
| `grid_order_history` | object[] | No | 生命周期历史记录 |
| `└ history_id` | string | Yes | 历史记录 ID，同时用作分页游标 |
| `└ created_at` | string | Yes | 事件时间，RFC3339 格式 |
| `└ suspend_reason` | string | Yes | 暂停原因（如适用） |
| `└ reason` | string | Yes | 事件的可读描述 |
| `history_has_more` | boolean | Yes | 是否可通过 `history_id` 分页获取更多历史记录 |
| `support_shortsell` | boolean | Yes | 是否允许卖空 |
| `rth` | int32 | Yes | 盘中交易时段标识（`0` / `1` / `2`） |
| `grid_order_type_up` | string | Yes | `trigger_sell_depth` 为 `0` 时的卖出方向订单类型。**枚举值：**, `GMO` / `GLO` / `GTG` |
| `grid_order_type_down` | string | Yes | `trigger_buy_depth` 为 `0` 时的买入方向订单类型。**枚举值：**, `GMO` / `GLO` / `GTG` |

### Response JSON Example

```json
{
  "code": 0,
  "message": "success",
  "data": {
    "order_id": "764609681686573056",
    "symbol": "700.HK",
    "stock_name": "TENCENT",
    "status": "Performing",
    "grid_status": "Performing",
    "suspend_reason": "",
    "sleeping_reason": "",
    "submitted_base_price": "300",
    "current_base_price": "300",
    "upper_limit_price": "360",
    "lower_limit_price": "240",
    "trigger_price_type": 2,
    "trigger_spread_up": "",
    "trigger_spread_down": "",
    "trigger_percent_up": "2",
    "trigger_percent_down": "2",
    "pullback_percent": "",
    "pullback_spread": "",
    "rebound_percent": "",
    "rebound_spread": "",
    "multiple_trigger": false,
    "time_in_force": 1,
    "trigger_quantity": "100",
    "trigger_sell_quantity": "0",
    "trigger_buy_quantity": "0",
    "upper_limit_quantity": "200",
    "lower_limit_quantity": "100",
    "upper_limit_event": 1,
    "lower_limit_event": 1,
    "trigger_sell_depth": 0,
    "trigger_buy_depth": 0,
    "created_at": "2024-08-12T10:30:00+08:00",
    "updated_at": "2024-08-12T10:30:00+08:00",
    "settlement_currency": "HKD",
    "expire_time": "",
    "gtd": "",
    "grid_sub_orders": [],
    "sub_has_more": false,
    "grid_order_history": [
      {
        "history_id": "764609681686573100",
        "created_at": "2024-08-12T10:30:00+08:00",
        "status": "Performing",
        "suspend_reason": "",
        "reason": "Grid order started"
      }
    ],
    "history_has_more": false,
    "support_shortsell": false,
    "rth": 0,
    "grid_order_type_up": "GMO",
    "grid_order_type_down": "GMO"
  }
}
```
