> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.immix.xyz/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.immix.xyz/_mcp/server.

# Candlesticks

**`Request — sent`**

```json title="Request — sent"
{
  "op": "subscribe",
  "params": {
    "topics": [
      "candlestick.{symbol}.{interval}"
    ]
  }
}
```

**`Response — received`**

```json title="Response — received"
{
  "op": "subscribe",
  "success": true,
  "topics": [
    {
      "topic": "candlestick.{symbol}.{interval}",
      "state": "live"
    }
  ]
}
```

**`Push data — received`**

```json title="Push data — received"
{
  "event": "candlestick",
  "topic": "candlestick.{symbol}.{interval}",
  "seq": "<string>",
  "seqTs": "<string>",
  "data": {
    "snapshot": true,
    "interval": "ONE_MINUTE",
    "bars": [
      {
        "timestamp": "<string>",
        "open": "<string>",
        "high": "<string>",
        "low": "<string>",
        "close": "<string>",
        "volume": "<string>",
        "count": 0,
        "closed": true
      }
    ]
  }
}
```

Each frame is its shape, read off the contract: `<string>` stands for a value, and a union shows its first form.

**URL** `wss://marketdata.immix.xyz/`

**Topic** `candlestick.{symbol}.{interval}`

| Topic parameter | Description                                                |
| --------------- | ---------------------------------------------------------- |
| `symbol`        | refdata's canonical symbol, e.g. OKX\@BTC/USDT             |
| `interval`      | one of components.schemas.candleInterval, e.g. ONE\_MINUTE |

## Request parameters

| Parameter  | Type             | Required | Description                                                                                      |
| ---------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------ |
| `op`       | string           | Yes      | `subscribe`                                                                                      |
| `reqId`    | string           | No       | client correlation id, echoed verbatim on the ack                                                |
| `params`   | object           | Yes      |                                                                                                  |
| > `topics` | array of strings | Yes      | the dotted topic string, e.g. trade.OKX\@BTC/USDT or candlestick.OKX\@BTC/USDT.ONE\_MINUTE.250ms |

## Response parameters

| Parameter      | Type             | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `op`           | string           | Yes      | One of `auth`, `subscribe`, `unsubscribe`, `error`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `reqId`        | string           | No       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `success`      | boolean          | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `error`        | string           | No       | One of `auth_required`, `invalid_token`, `unknown_op`, `malformed`, `too_many_topics`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `topics`       | array of objects | No       | answers ride in request order — the correlator for entries whose topic could not compose (error rows echo the composed topic best-effort, absent parts empty)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| > `topic`      | string           | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| > `state`      | string           | Yes      | live: data flows now (latest-image lanes — tob, mark, funding, oi, ticker — answer live whether or not an image is held yet; the first image flows on arrival). syncing (book topics): the gateway holds no synced book yet — the snapshot is pushed unprompted the moment it syncs, at latest one connector restate interval. error on a plain (string-topic) row, no code: the topic composed nothing, and it never arms retroactively. Either the channel is outside the vocabulary or the tier suffix is outside the configured set (an unrecognized suffix reads as part of the symbol) — correct the topic — or the symbol is unknown to the gateway's refdata fold (derivative symbols are refdata's ccxt spelling BASE/QUOTE:SETTLE, e.g. OKX\@BTC/USDT:USDT — there is no :SWAP form) — resubscribe once refdata holds the instrument. Composite rows: live iff every enabled source book is synced, stated within the topic's output scales, AND every required FX pair is current (the full image pushes immediately); syncing otherwise, kept by the first tick at which the composite becomes computable — a source out for precision is named by a degraded frame at that tick, since syncing alone does not say it; a composite error row carries code. One of `live`, `syncing`, `error`, `unsubscribed`, `not_subscribed`. |
| > `priceScale` | integer          | No       | composite live/syncing rows only — the resolved output price scale (max over all configured sources' reference records, disabled included), bounding the fractional digits any price on the topic can carry; never padding. It holds until a status rescaled frame on the topic restates it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| > `qtyScale`   | integer          | No       | composite rows only — the resolved output qty scale; as priceScale                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| > `code`       | string           | No       | composite error rows only — the closed vocabulary clients parse; every validation failure maps to exactly one code. One of `unknown_channel`, `bad_name`, `bad_tier`, `tier_required`, `name_in_use`, `unknown_instrument`, `duplicate_source`, `mixed_base_asset`, `unit_mismatch`, `bad_normalisation`, `bad_depth`, `bad_ladder`, `too_many_sources`, `budget_exceeded`, `malformed`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| > `message`    | string           | No       | supplementary human text naming the offending source or field — never something a client parses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

## Push data parameters

| Parameter       | Type             | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------- | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event`         | string           | Yes      | `candlestick`                                                                                                                                                                                                                                                                                                                                                                                                        |
| `topic`         | string           | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `seq`           | string           | No       | provenance global sequence, as a decimal string                                                                                                                                                                                                                                                                                                                                                                      |
| `seqTs`         | string           | No       | provenance sequencerTs, epoch-ns as a decimal string                                                                                                                                                                                                                                                                                                                                                                 |
| `data`          | object           | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| > `snapshot`    | boolean          | Yes      | true exactly on the subscribe-time frame (never conflated); updates carry one bar                                                                                                                                                                                                                                                                                                                                    |
| > `interval`    | string           | Yes      | The candle interval vocabulary, shared with the candle-history surface so stream closes and history rows describe the same buckets. TEN\_SECONDS is deliberately absent: a stream interval the history query cannot return would break stream/history consistency the day it shipped. One of `ONE_MINUTE`, `FIVE_MINUTES`, `FIFTEEN_MINUTES`, `THIRTY_MINUTES`, `ONE_HOUR`, `FOUR_HOURS`, `TWELVE_HOURS`, `ONE_DAY`. |
| > `bars`        | array of objects | Yes      | oldest to newest; apply keyed on timestamp                                                                                                                                                                                                                                                                                                                                                                           |
| > > `timestamp` | string           | Yes      | bucket start, epoch-ns as a decimal string, UTC-aligned to an epoch multiple of the interval — the same normalization the candle-history query applies                                                                                                                                                                                                                                                               |
| > > `open`      | string           | Yes      | exact decimal string in shortest form, at the scale the bar holds its prices at (high, low and close alike) — the digit count is not a contract                                                                                                                                                                                                                                                                      |
| > > `high`      | string           | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| > > `low`       | string           | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| > > `close`     | string           | Yes      |                                                                                                                                                                                                                                                                                                                                                                                                                      |
| > > `volume`    | string           | Yes      | exact decimal string in shortest form, at the scale the bar holds its quantities at                                                                                                                                                                                                                                                                                                                                  |
| > > `count`     | integer          | Yes      | trades folded into the bar; 0 marks a carried empty bar                                                                                                                                                                                                                                                                                                                                                              |
| > > `closed`    | boolean          | Yes      | final bars never conflate; re-applying a final — over its own partial, or a repeat received around a subscribe — is idempotent (apply keyed on the bucket timestamp, final values win)                                                                                                                                                                                                                               |

## Behaviour

The raw form streams a forming-bar partial per folded trade; the conflated form candlestick.\{symbol}.\{interval}.\{tier} delivers the latest forming bar once per tick. Closed bars never conflate: every elapsed interval closes — zero-trade intervals as a carried close (open = high = low = close = previous close, volume "0", count 0) — released once the stream's consumed event-time frontier passes the bucket boundary (never wall clock: under catch-up closes arrive late, never wrong). Per topic, the update flow a session sees after its snapshot delivers exactly one closed: true frame per bucket, before any frame of the next bucket; bucket timestamp continuity is the channel's integrity signal, and seq/seqTs are fact provenance (repeats legal). Around the subscribe itself, snapshot and topic broadcasts may overlap — a just-subscribed session can receive finals its snapshot already carried, or one older filling toward them; re-applying a final keyed on the bucket timestamp is a no-op, never desync. Subscribing answers live and pushes one snapshot: true frame — the last two closed bars plus the forming bar, oldest to newest, one apply loop — or bars: \[] with seq/seqTs omitted for a never-traded instrument, whose boundaries then stay silent until a first close exists. Long-disconnect catch-up is the candle-history query, not this stream. The interval segment is mandatory (components.schemas.candleInterval); the object subscribe form \{"channel":"candlestick","instrument":SYMBOL,"interval":INTERVAL,"throttle":TIER} is equivalent and echoed normalized as the dotted string.