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