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 key: this and ohlcv_history are the two events that ask for one - join the Telegram group to get yours.
This event needs a free data key. Join the Telegram group and ask for one; it puts a name to who is pulling candles, meters nothing and costs nothing. Everything else on the data API is keyless.
| Channel | Socket.IO event |
| Auth | free key in the handshake, auth: { api_key } |
| Emits | ohlcv |
| Cost | Free |
Example
- JavaScript
- Python
import { io } from "socket.io-client";
const socket = io("https://sol.shrine.trade", { auth: { api_key: "sk_…" } }); // free key
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…" });
import socketio
from datetime import datetime
sio = socketio.Client()
@sio.on("ohlcv")
def on_ohlcv(rows):
for t, o, h, l, c, v in rows:
print(datetime.fromtimestamp(t / 1000), f"o={o} h={h} l={l} c={c} v={v}")
sio.connect("https://sol.shrine.trade", auth={"api_key": "sk_…"}) # free key
sio.emit("subscribe_ohlcv", {"pool": "4mBL…"})
sio.wait()
# later, to stop (free): sio.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" }
error | When |
|---|---|
invalid_request | Neither mint nor pool was provided. |
not_found | The mint has no active pool, or the given pool has neither live data nor candle history. |
unavailable | A transient backend error (the server already retried). Safe to retry - it is not a definitive "not found". |
limit_exceeded | This 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
- Free. The key only puts a name to who is pulling candles; nothing is metered.
- Granularity is 1s; aggregate client-side if you want 1m/5m/1h.
- Seed the initial window with
ohlcv_history(same key), then keep it live here. - For per-trade detail use
subscribe_trades. - For a full working chart see Examples → OHLCV chart.