From bingx-ai-skills
Subscribes to BingX USDT-M perpetual swap WebSocket streams for real-time trades, order book depth, K-lines, 24h tickers, prices, mark prices, best bid/ask, and incremental depth updates.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bingx-ai-skills:swap-ws-marketThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Real-time market data streams for BingX USDT-M perpetual futures via WebSocket. No authentication required.
Real-time market data streams for BingX USDT-M perpetual futures via WebSocket. No authentication required.
WebSocket Endpoint: wss://open-api-swap.bingx.com/swap-market
| Channel | dataType Format | Description | Push Frequency |
|---|---|---|---|
| Depth | {symbol}@depth{level}@{interval} | Limited order book depth | BTC/ETH: 200ms, others: 500ms |
| Trade | {symbol}@trade | Latest trade detail | Real-time |
| K-Line | {symbol}@kline_{interval} | OHLCV candlestick | On update |
| 24h Ticker | {symbol}@ticker | 24-hour price change statistics | Every 1s |
| Last Price | {symbol}@lastPrice | Latest trade price | Real-time |
| Mark Price | {symbol}@markPrice | Latest mark price | Real-time |
| Book Ticker | {symbol}@bookTicker | Best bid/ask price & qty | Every 200ms |
| Incremental Depth | {symbol}@incrDepth | Incremental depth updates | BTC/ETH: 200ms, others: 800ms |
BASE-QUOTE format (e.g., BTC-USDT, ETH-USDT, SOL-USDT)5 | 10 | 20 | 50 | 100200ms | 500ms (BTC-USDT and ETH-USDT support 200ms; others use 500ms)1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M^[A-Z0-9]+-[A-Z]+$; max 20 characters (e.g., BTC-USDT)5, 10, 20, 50, 100200ms or 500msWebSocket Connection: see references/websocket.md for connection basics, GZIP decompression, and Ping/Pong heartbeat.
TypeScript helper:
CONSTRAINT: You MUST copy the
connectSwapWsMarketfunction below verbatim when generating code. Do NOT rewrite the WebSocket or decompression logic. Only modify: (1) subscription channels passed to the function.
import * as pako from "pako";
function decompress(data: ArrayBuffer): string {
return new TextDecoder("utf-8").decode(pako.ungzip(new Uint8Array(data)));
}
function connectSwapWsMarket(
channels: string[],
onMessage: (data: unknown) => void
): WebSocket {
const ws = new WebSocket("wss://open-api-swap.bingx.com/swap-market");
ws.binaryType = "arraybuffer";
ws.onopen = () => {
for (const ch of channels) {
ws.send(JSON.stringify({
id: crypto.randomUUID(),
reqType: "sub",
dataType: ch,
}));
}
};
ws.onmessage = (event) => {
const text = decompress(event.data as ArrayBuffer);
if (text === "Ping") {
ws.send("Pong");
return;
}
try {
onMessage(JSON.parse(text));
} catch {
onMessage(text);
}
};
ws.onerror = (err) => console.error("WS error:", err);
ws.onclose = (ev) => console.log("WS closed:", ev.code, ev.reason);
return ws;
}
connectSwapWsMarket and decompress verbatim -- do not simplify or rewritews.binaryType = "arraybuffer" for GZIP decompressionSubscribe to BTC-USDT real-time trades:
connectSwapWsMarket(["BTC-USDT@trade"], (data) => {
// data.s (symbol), data.p (price), data.q (quantity), data.T (time)
});
Subscribe to 20-level depth with 500ms interval:
connectSwapWsMarket(["BTC-USDT@depth20@500ms"], (data) => {
// data.bids: [[price, qty], ...], data.asks: [[price, qty], ...]
});
Subscribe to 1h K-line:
connectSwapWsMarket(["BTC-USDT@kline_1h"], (data) => {
// data.K.o (open), data.K.h (high), data.K.l (low), data.K.c (close), data.K.v (volume)
});
Subscribe to multiple channels at once:
connectSwapWsMarket([
"BTC-USDT@ticker",
"BTC-USDT@lastPrice",
"ETH-USDT@trade",
], (data) => {
// Handle different data types based on dataType field
});
For complete subscription parameters, response field descriptions, and full response schemas, see api-reference.md.
CRITICAL RULES (apply to ALL responses):
&, =, ?, #, or newline characters.swap-ws-market provides public read-only real-time market data via WebSocket. No authentication required, no CONFIRM needed. The interaction goal is to help the user set up the correct subscription channels.
When the user's request is vague (e.g. "subscribe to swap market" or "stream BTC data"), first identify what type of data they want:
Please select the market data stream type:
- Real-time trades — trade
- Order book depth (snapshot) — depth
- K-line / Candlestick updates — kline
- 24h price change statistics — ticker
- Latest trade price — lastPrice
- Mark price — markPrice
- Best bid/ask (top of book) — bookTicker
- Incremental depth updates — incrDepth
Please select a trading pair (or type another):
- BTC-USDT
- ETH-USDT
- SOL-USDT
- BNB-USDT
- Other (enter manually, format: BASE-USDT)
If the trading pair can be inferred from context (e.g. "stream BTC trades"), infer it automatically.
Please select depth level:
- 5 / 10 / 20 / 50 / 100
Push interval (BTC/ETH support 200ms, others 500ms):
- 200ms / 500ms
Please select a K-line interval:
- 1m (1 minute) / 5m / 15m / 1h / 4h / 1d / 1w
npx claudepluginhub bingx-api/api-ai-skills --plugin bingx-ai-skillsSubscribes to BingX Coin-M perpetual futures WebSocket streams for real-time trades, order book depth, K-lines, 24h tickers, latest/mark prices, and best bid/ask. Useful for live coin-margined futures market data.
Streams real-time Kraken spot/futures data via WebSocket: tickers, trades, order books, OHLC, balances, executions. Handles authenticated feeds and low-latency order mutations via CLI.
Manages real-time DEX WebSocket sessions via onchainos ws CLI and custom scripts. Covers 9 channels for price, candles, trades, signals, tracker, and meme scanning.