# 成交明细

`WS` `request · cmd 17`

> **行情权限要求 · 免费**
> 美股：默认免费赠送 US LV1 实时行情（近 1000 笔，含盘前、盘中、盘后、夜盘全时段）。
> 港股：默认赠送 LV1 实时行情（近 1000 笔）。
> 美股期权：默认无权限，需购买「OPRA 美股期权行情 (OpenAPI)」行情卡，最多可获取近 1000 笔。
> _OpenAPI 行情权限独立于 App/Web 行情权限_

该接口用于获取标的的成交明细数据。

```protobuf
message SecurityTradeRequest {
  string symbol = 1;
  int32 count = 2;
}

message SecurityTradeResponse {
  string symbol = 1;
  repeated Trade trades = 2;
}
```

## Request Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `symbol` | string | Yes | 标的代码，使用 ticker.region 格式，例如：700.HK |
| `count` | int32 | Yes | 请求的逐笔明细数量；最大 1000 |

## Response Fields

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `symbol` | string | No | 标的代码 |
| `trades` | object[] | No | 逐笔明细数据 |
| `└ price` | string | No | 价格 |
| `└ volume` | int64 | No | 成交量 |
| `└ timestamp` | int64 | No | 成交时间 |
| `└ trade_type` | string | No | 交易类型说明 |
| `└ direction` | int32 | No | 交易方向 (0-neutral, 1-down, 2-up) |
| `└ trade_session` | int32 | No | 交易时段 |

## Response JSON Example

```json
{
  "symbol": "AAPL.US",
  "trades": [
    {
      "price": "158.760",
      "volume": 1,
      "timestamp": 1651103979,
      "trade_type": "I",
      "direction": 0,
      "trade_session": 2
    }
  ]
}
```
