# OHLC

{% 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 %}

The accepted values for interval are 1, 5, 15, 30, 60, 240, 1440, 10080, 21600.&#x20;

### Subscribe with Pusher

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

### Subscribe Request Payload

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

### Examples

Subscribing to NIZAUSDT ohlc with 1 hour interval.

<details>

<summary>Pusher</summary>

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

</details>

<details>

<summary>WebSocket API in Javascript</summary>

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

</details>

### Payload

| Name                 | Type    | Description                                                       |
| -------------------- | ------- | ----------------------------------------------------------------- |
| channel              | string  | The name of the channel                                           |
| type                 | string  | Type of event notification                                        |
| timestamp            | string  | The timestamp of the start of the interval                        |
| data                 | array   | The payload of OHLC data                                          |
| data.symbol          | string  | The symbol of the of the currency pair                            |
| data.open            | decimal | The opening trade price within the interval.                      |
| data.high            | decimal | The highest trade price within the interval.                      |
| data.low             | decimal | The lowest trade price within the interval.                       |
| data.close           | decimal | The last trade price within the interval.                         |
| data.trades          | integer | Number of trades within the interval.                             |
| data.volume          | decimal | Total traded volume (in base currency terms) within the interval. |
| data.vwap            | decimal | Volume weighted average trade price within the interval.          |
| data.interval\_begin | string  | The timestamp of start of the interval. Format: RFC3339           |
| data.interval        | integer | The timeframe from the interval in minutes.                       |

### Example of the Payload

```json
{
   "channel": "ohlc",
   "type": "update",
   "timestamp": "2024-09-18 18:09:32.533726",
   "data": {
       "symbol": "NIZA\/USDT",
       "open": "100.00000000",
       "high": "100.00000000",
       "low": "100.00000000",
       "close": "100.00000000",
       "trades": 1,
       "volume": "100.00000000",
       "vwap": "100.00000000",
       "interval_begin": "2024-09-18T16:09:00.000000Z",
       "interval": 1,
       "timestamp": "2024-09-18T16:10:00.000000Z"
   }
}
```


---

# 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/ohlc.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.
