Skip to main content

subscribe_ohlcv - live candles

Live 1-second OHLCV candles for a pool. The server emits ohlcv every time the current bucket changes (≤1 update/sec). Pass one of mint or pool. Free with a free key from the Telegram group, one token at a time; with your plan's key, every token.

A key: free, or your plan's

Live candles need a key. On the Free plan, ask for a free one in the Telegram group: it follows one token's candles at a time, so unsubscribe before you switch, or a second subscribe answers limit_exceeded. With your plan's key from the dashboard, subscribe to every token you like. Pass either in the handshake, auth: { api_key }; without one the call answers api_key_required.

ChannelSocket.IO event
Autha key in the handshake, auth: { api_key }: a free one from the Telegram group (one token) or your plan's (every token)
Emitsohlcv
CostFree: 1 token, 1 socket · Lite: every token, 3 sockets · Developer: every token, 10 sockets

Example​

import { io } from "socket.io-client";

const socket = io("https://sol.shrine.trade", { auth: { api_key: "sk_…" } }); // optional: your plan's key, for every token

socket.on("ohlcv", (rows) => {
for (const [t, o, h, l, c, v] of rows) {
console.log(new Date(t), `o=${o} h=${h} l=${l} c=${c} v=${v}`);
}
});

socket.emit("subscribe_ohlcv", { pool: "4mBL…" });

// later, to stop (free): socket.emit("unsubscribe_ohlcv", { pool: "4mBL…" });

Response - ohlcv​

An array of candle tuples (usually one per emission). Each tuple is [ timestamp_ms, open, high, low, close, volume ]:

[[1779812627000, 0.000000033, 0.000000034, 0.000000033, 0.000000034, 5.12]]

The tuple format matches what lightweight-charts, TradingView, Chart.js financial, etc. expect - so it drops straight into a chart.

Errors​

If the subscription cannot be created, the ack callback receives an error object instead of { ok: true }:

{ "error": "not_found", "message": "pool not found" }
errorWhen
invalid_requestNeither mint nor pool was provided.
not_foundThe mint has no active pool, or the given pool has neither live data nor candle history.
unavailableA transient backend error (the server already retried). Safe to retry - it is not a definitive "not found".
limit_exceededThis connection already has the maximum number of subscriptions.

If you do not pass an ack callback, the same payload is emitted as a subscription_error event instead.

Try it​

Notes​

  • On Free, a free key from the Telegram group; nothing is metered.
  • Granularity is 1s; aggregate client-side if you want 1m/5m/1h.
  • Seed the initial window with ohlcv_history (no key needed once a minute), then keep it live here.
  • For per-trade detail use subscribe_trades.
  • For a full working chart see the chart example.