Quickstart
1. Connect
Open a WebSocket to wss://aeonfeed.com/ws. The server answers with a welcome message that lists the pairs, exchanges and limits.
2. Subscribe
Send a subscribe message with one or more channels:
json
{ "op": "subscribe", "channels": ["ticker:BTCUSDT", "agg:*"] }ticker:BTCUSDT: BTC/USDT quotes from every exchange.agg:*: a cross-exchange summary of all 100 pairs.
You can also subscribe in the URL: wss://aeonfeed.com/ws?subscribe=ticker:BTCUSDT,agg:*
3. Handle messages
You first receive a snapshot for each channel, then ticker or agg delta messages that contain only what changed. Merge deltas into your local state by exchange (ex) for tickers and by symbol (s) for aggregates.
const ws = new WebSocket("wss://aeonfeed.com/ws");
ws.onopen = () => {
ws.send(JSON.stringify({ op: "subscribe", channels: ["ticker:BTCUSDT"] }));
};
ws.onmessage = (e) => {
const msg = JSON.parse(e.data);
if (msg.type === "ticker" || msg.type === "snapshot") {
for (const q of msg.data) console.log(q.ex, "bid", q.b, "ask", q.a);
}
};# pip install websockets
import asyncio, json, websockets
async def main():
async with websockets.connect("wss://aeonfeed.com/ws") as ws:
await ws.send(json.dumps({"op": "subscribe", "channels": ["ticker:BTCUSDT"]}))
async for raw in ws:
msg = json.loads(raw)
if msg["type"] in ("ticker", "snapshot"):
for q in msg["data"]:
print(q["ex"], "bid", q["b"], "ask", q["a"])
asyncio.run(main())// tokio-tungstenite = { version = "0.24", features = ["native-tls"] }
use futures::{SinkExt, StreamExt};
use tokio_tungstenite::{connect_async, tungstenite::Message};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let (mut ws, _) = connect_async("wss://aeonfeed.com/ws").await?;
ws.send(Message::text(r#"{"op":"subscribe","channels":["ticker:BTCUSDT"]}"#)).await?;
while let Some(msg) = ws.next().await {
if let Message::Text(t) = msg? {
println!("{t}");
}
}
Ok(())
}npx wscat -c "wss://aeonfeed.com/ws?subscribe=ticker:BTCUSDT"curl https://aeonfeed.com/v1/ticker/BTCUSDTUsing TypeScript?
The repo ships a tiny typed client, @aeon-feed/client, with auto-reconnect and re-subscribe:
ts
import { FeedClient } from "@aeon-feed/client";
const feed = new FeedClient({ url: "wss://YOUR_HOST/ws" }).connect();
feed.subscribe("agg:*", "ticker:ETHUSDT");
feed.on("ticker", (symbol, quotes, isSnapshot) => console.log(symbol, quotes));
feed.on("agg", (rows) => console.log(rows.length, "pairs updated"));