> For the complete documentation index, see [llms.txt](https://docs.hello.trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hello.trade/developer-tools/websocket-api/market-data.md).

# Market Data

Public market data is available via WebSocket without authentication.

**Endpoint**: `wss://marketdata.app.hello.trade/ws`

## Available Channels

| Channel                                                                       | Description                                                                          |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [ticker](/developer-tools/websocket-api/market-data/light-tickers.md)         | Market data snapshots with prices, volume, 24h stats, mark prices, and funding rates |
| [orderbook](/developer-tools/websocket-api/market-data/partial-order-book.md) | Order book snapshots with configurable depth (1, 5, 10, 20, or 100 levels)           |
| [trades](/developer-tools/websocket-api/market-data/live-trades.md)           | Real-time trade executions                                                           |
| [candles](/developer-tools/websocket-api/market-data/candles.md)              | OHLCV candlestick data with configurable intervals                                   |
| [instruments](/developer-tools/websocket-api/market-data/instrument-list.md)  | Instrument list with metadata and status                                             |

***

## Connection

Connect to the WebSocket endpoint and subscribe to channels using JSON messages.

**CLI Example:**

```bash
wscat -c wss://marketdata.app.hello.trade/ws

# Subscribe to ticker for BTC and ETH
{"type":"subscribe","channel":"ticker","symbols":["BTC","ETH"]}

# Subscribe to orderbook
{"type":"subscribe","channel":"orderbook","symbols":["BTC"],"levels":10}

# Subscribe to all instruments
{"type":"subscribe","channel":"instruments"}
```

***

## Subscription Format

**Subscribe Request:**

```json
{
  "type": "subscribe",
  "channel": "channelName",
  "sid": "my-request-1",
  "symbols": ["BTC", "ETH"]
}
```

| Field     | Type      | Required | Description                                                                                                                                                                                                                                                                                                                                                                 |
| --------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`    | string    | Yes      | Must be `"subscribe"`                                                                                                                                                                                                                                                                                                                                                       |
| `channel` | string    | Yes      | Channel name (see Available Channels)                                                                                                                                                                                                                                                                                                                                       |
| `sid`     | string    | No       | Client-supplied identifier, echoed back on every response tied to this subscription (`subscribed` and `marketData` messages). Lets a client open multiple concurrent requests for the same channel/symbol (e.g. two different candle date ranges) and tell their responses apart, instead of relying on symbol matching. Omit it and nothing changes from today's behavior. |
| `symbols` | string\[] | Varies   | List of symbols (required for most channels, optional for `instruments`)                                                                                                                                                                                                                                                                                                    |

**Unsubscribe Request:**

```json
{
  "type": "unsubscribe",
  "channel": "channelName",
  "sid": "my-request-1",
  "symbols": ["BTC"]
}
```

`sid` is optional here too and is only echoed back on the `unsubscribed` confirmation — it doesn't change which subscription gets torn down (that's still determined by `channel` + params).

**Response Format:**

```json
{
  "type": "marketData",
  "channel": "channelName",
  "sid": "my-request-1",
  "data": {
    // Channel-specific data
  }
}
```

`sid` is only present in the response if the subscribe request included one; otherwise the field is omitted entirely, exactly as before.

***

## Error Response

```json
{
  "type": "error",
  "message": "Invalid subscription request",
  "code": 400
}
```

| Code | Description                  |
| ---- | ---------------------------- |
| 400  | Invalid subscription request |

See individual channel documentation for detailed specifications and examples.
