# 網格訂單詳情

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