# Recent Trades

The trade channel generates a trade event when orders are matched in the book. Multiple trades may be batched in a single message but that does not mean that these trades resulted from a single taker order.

{% hint style="info" %}
When subscribing, the `pair should` be set in **alphanumeric format only**. Do not use separators between the base and quote asset. The correct format for NIZA/USDT to be set in a channel name is `NIZAUSDT`.
{% endhint %}

### Subscribe with Pusher

```javascript
var channel = pusher.subscribe("trade.{pair}");
```

### Subscribe Request Payload

```javascript
{
   "event": "pusher:subscribe",
   "data": {
       "channel": "trade.{pair}"
   }
}
```

### Examples

<details>

<summary>Pusher</summary>

```javascript
var channel = pusher.subscribe("trade.NIZAUSDT");
```

</details>

<details>

<summary>WebSocket API in Javascript</summary>

```javascript
const message = {
        event: "pusher:subscribe",
        data: {
            channel: "trade.NIZAUSDT"
        }
    };
socket.send(JSON.stringify(message));
```

</details>

### Payload

| Name           | Type    | Description                                                          |
| -------------- | ------- | -------------------------------------------------------------------- |
| channel        | string  | The name of the channel                                              |
| type           | string  | Type of event notification                                           |
| data           | array   | The payload of trade data                                            |
| data.ord\_type | string  | Possible values: \[limit, market] The order type of the taker order. |
| data.price     | decimal | Average price of the trade.                                          |
| data.qty       | decimal | Size of the trade.                                                   |
| data.side      | string  | The side of the taker order.                                         |
| data.symbol    | string  | Example: "NIZA/USD" The symbol of the currency pair.                 |
| data.timestamp | string  | Format: RFC3339. The book order update timestamp.                    |
| data.trade\_id | integer | Trade identifier is a sequence number, unique per book               |

### Example of the Payload

```json
{
   "channel": "trade",
   "type": "update",
   "data": [
       {
           "ord_type": "limit",
           "price": "100.00000000",
           "qty": "100.00000000",
           "side": "sell",
           "symbol": "NIZA\/USDT",
           "timestamp": "2024-09-18 23:31:27.572200",
           "trade_id": 78236
       }
   ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.niza.io/websocket-api-1.0/public-channels/recent-trades.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
