# Trades

`WS` `request · cmd 17`

> **Quote Permission Required · Free**
> US stocks: US LV1 included free by default (last ~1,000 ticks across pre-market, regular, after-hours, and overnight sessions).
> HK stocks: LV1 included by default (last ~1,000 ticks).
> US options: no permission by default — purchase "OPRA US Options Quotes (OpenAPI)".
> _OpenAPI quote perms are separate from App/Web perms_

This API is used to obtain the trades data of security.

```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 | Security code, in ticker.region format, e.g. 700.HK |
| `count` | int32 | Yes | Count of trades; max 1000 per request |

## Response Fields

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `symbol` | string | No | Security code |
| `trades` | object[] | No | Trades data |
| `└ price` | string | No | Price |
| `└ volume` | int64 | No | Volume |
| `└ timestamp` | int64 | No | Time of trading |
| `└ trade_type` | string | No | Trade type |
| `└ direction` | int32 | No | Trade direction (0-neutral, 1-down, 2-up) |
| `└ trade_session` | int32 | No | Trade session |

## Response JSON Example

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