How to install okx-dex-ws
npx skills add https://github.com/okx/onchainos-skills --skill okx-dex-wsFull instructions (SKILL.md)
Source of truth, from okx/onchainos-skills.
name: okx-dex-ws description: "Use this skill when the user mentions 'onchainos ws', 'ws start', 'ws poll', 'ws stop', 'ws channels', 'ws session', 'ws channel-info', 'idle-timeout', 'idle timeout', 'WebSocket channels', 'WS频道', or asks about managing WebSocket sessions/会话管理. Also use when writing a custom WebSocket script/脚本/bot for real-time on-chain data. Covers: onchainos ws CLI commands (start/poll/stop/list/channels/channel-info), session lifecycle, idle-timeout configuration, and all 9 DEX WebSocket channels (price, candle, trades, price-info, signals, tracker, meme scanning)." license: MIT metadata: author: okx version: "4.0.0" homepage: "https://web3.okx.com"
Onchain OS DEX WebSocket — Unified Skill
Two ways to consume real-time DEX data:
- CLI (
onchainos ws) — start a background session, poll events incrementally. Best for monitoring and agent-driven workflows. - Script — write a custom WebSocket client in Python/Node/Rust. Best for bots and custom logic.
Pre-flight Checks
Read
../okx-agentic-wallet/_shared/preflight.md. If that file does not exist, read_shared/preflight.mdinstead.
Prerequisites
This skill references ws-protocol.md files from okx-dex-market, okx-dex-token, okx-dex-signal, and okx-dex-trenches. If a referenced file is not found, the corresponding skill may not be installed — inform the user and suggest installing the missing skill from the onchainos-skills plugin.
Related Workflows
When one of the following commands is used, show the related workflow hint after displaying results:
| Command | Workflow | File |
|---|---|---|
ws start, ws poll, ws stop | Wallet Monitor (WebSocket) | ~/.onchainos/workflows/wallet-monitor-ws.md |
Hint format: "You can also try out our Wallet Monitor (WebSocket) workflow for more comprehensive results. Would you like to try it?"
Approach 1: CLI (onchainos ws)
Discover Channels
onchainos ws channels # list all 9 supported channels
onchainos ws channel-info --channel <name> # detailed info + example for a channel
Start / Poll / Stop
onchainos ws start --channel <channel> [params] # start background session
onchainos ws poll --id <ID> [--channel <ch>] # pull new events
onchainos ws list # list sessions
onchainos ws stop [--id <ID>] # stop session(s)
Channel Quick Reference
| Channel | Group | Pattern | Required Params |
|---|---|---|---|
kol_smartmoney-tracker-activity | signal | global | (none) |
address-tracker-activity | signal | per-wallet | --wallet-addresses |
dex-market-new-signal-openapi | signal | per-chain | --chain-index |
price | market | per-token | --token-pair |
dex-token-candle{period} | market | per-token | --token-pair |
price-info | token | per-token | --token-pair |
trades | token | per-token | --token-pair |
dex-market-memepump-new-token-openapi | trenches | per-chain | --chain-index |
dex-market-memepump-update-metrics-openapi | trenches | per-chain | --chain-index |
Parameter Formats
--token-pair:chainIndex:tokenContractAddress(e.g.1:0xdac17f958d2ee523a2206206994597c13d831ec7)--chain-index: comma-separated chain IDs (e.g.1,501,56)--wallet-addresses: comma-separated addresses, max 200--idle-timeout: auto-stop if no poll within this duration (default30m;1h,2h,300s,0to disable)
Examples
# Smart money trade feed
onchainos ws start --channel kol_smartmoney-tracker-activity
# Track specific wallets
onchainos ws start --channel address-tracker-activity --wallet-addresses 0xAAA,0xBBB
# Token price monitoring
onchainos ws start --channel price --token-pair 1:0xdac17f958d2ee523a2206206994597c13d831ec7
# Buy signal alerts on Ethereum + Solana
onchainos ws start --channel dex-market-new-signal-openapi --chain-index 1,501
# New meme token launches on Solana
onchainos ws start --channel dex-market-memepump-new-token-openapi --chain-index 501
# K-line 1-minute candles
onchainos ws start --channel dex-token-candle1m --token-pair 1:0xdac17f958d2ee523a2206206994597c13d831ec7
Poll Filters (tracker channels only)
When polling kol_smartmoney-tracker-activity or address-tracker-activity, these filters are available:
--min-quote-amount,--min-market-cap,--min-pnl--trader(wallet address prefix match)--tag(smart_money or kol)--trade-type(buy or sell)--since(ms timestamp)
Approach 2: Custom Script
When the user wants to build a custom WebSocket client with their own logic, read the corresponding protocol reference file:
Market Data (price & candlestick streams)
Read: ../okx-dex-market/references/ws-protocol.md
Channels: price, dex-token-candle{period}
Token Data (detailed token streams)
Read: ../okx-dex-token/references/ws-protocol.md
Channels: price-info, trades
Signal & Wallet Tracking
Read: ../okx-dex-signal/references/ws-protocol.md
Channels: dex-market-new-signal-openapi, kol_smartmoney-tracker-activity, address-tracker-activity
Meme/Trenches
Read: ../okx-dex-trenches/references/ws-protocol.md
Channels: dex-market-memepump-new-token-openapi, dex-market-memepump-update-metrics-openapi
Common Protocol (all channels share)
- Endpoint:
wss://wsdex.okx.com/ws/v6/dex - Auth: HMAC-SHA256 login required before subscribing
- Heartbeat: send
"ping"every 25s, expect"pong" - Subscribe:
{"op": "subscribe", "args": [...]} - Unsubscribe:
{"op": "unsubscribe", "args": [...]}
Related skills
More from okx/onchainos-skills and the wider catalog.
okx-dex-market
HARD BLOCK — NEVER use this skill for prediction-market / Polymarket UpDown queries. Route to okx-dapp-discovery when (a) a named DApp (Polymarket/Aave/Hyperliquid/PancakeSwap/Morpho) appears with any timeframe, OR (b) any 涨跌 / updown / 'up or down' phrase appears for BTC/ETH/SOL/XRP/BNB/DOGE/HYPE (e.g. '<COIN> 涨跌市场', '5 分钟涨跌', 'BTC up or down'). Example: 'BTC 5 分钟涨跌市场' → okx-dapp-discovery (NOT K-line). These are Polymarket prediction markets, not on-chain price queries. Use THIS skill for on-chain market data: token prices/价格, K-line/OHLC/candlestick/K线 charts, index prices, and wallet PnL/盈亏分析 (win rate, my wallet's DEX trade history, realized/unrealized PnL per token). Triggers: 'token price', 'price chart', 'K线', 'OHLC', 'how much is X worth', 'show my PnL', '胜率', '盈亏', 'my wallet DEX history', 'realized/unrealized profit'. NOTE: WebSocket script/脚本/bot → okx-dex-ws. ALSO the OWNER of Market API payment handling — route here (NOT okx-agent-payments-protocol) for: 'onchainos market 报 402', 'market price 402', 'market API pricing/计费/收费', Basic/Premium tier/quota/额度/免费额度, 'ok-web3-openapi-pay' header, 30 天过渡期/grace period, any MARKET_API_* notification code (NEW_USER_INTRO / OLD_USER_GRACE / OLD_USER_POST_GRACE_* / *_OVER_QUOTA), or 'confirming:true' response from onchainos market commands.
okx-wallet-portfolio
Public-address portfolio lookup across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ chains. Invoke when the user supplies a wallet address and wants its: balance, token holdings, total portfolio value, or DeFi positions (e.g. 'check balance of 0xAbc', 'what tokens does 0xAbc hold', 'portfolio value of this address'). Requires an explicit address — for the user's own logged-in wallet with no address use okx-agentic-wallet.
okx-dex-token
Use this skill for token-level data: search tokens, trending/hot tokens (热门, 代币榜单), liquidity pools, holder distribution (whale/巨鲸, sniper, bundler-tagged holder %), token risk metadata (riskControlLevel, tokenTags, dev stats, suspicious/bundle holding % via advanced-info), recent buy/sell activity, trade feed/逐笔成交/每笔交易/stream trades, top profit addresses, token trade history, detailed price info with market cap volume liquidity and holder count (price-info), or holder cluster analysis (持仓集中度, cluster overview, cluster rug pull risk/跑路风险, new wallet percentage/新钱包持仓比例, holder clusters, 'are top holders in same cluster'). Also handles Market API payment/计费/x402/402, Basic/Premium tier/quota/额度 questions, and MARKET_API_*_OVER_QUOTA / confirming:true responses on token endpoints (advanced-info, top-trader, cluster-*, trades, hot-tokens). NOTE: if the user wants to write a WebSocket script/脚本/bot, use okx-dex-ws instead.
okx-dex-swap
Use this skill to swap, trade, buy, sell, exchange, or convert tokens, get a swap quote, execute a trade, find the best or cheapest swap route, compare swap rates, get swap calldata, or build an unsigned swap tx across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, or 20+ chains. OKX-aggregated routing over 500+ DEX sources with slippage control, price-impact protection, and cross-DEX route optimization. For OKX-aggregated swaps with no named venue. If the prompt names a specific DApp as the swap venue (Polymarket, Aave, Hyperliquid, PancakeSwap, Morpho, Raydium, Curve, Compound, Pendle, Lido, ether.fi, GMX, Kamino, Orca, Meteora, Clanker, pump.fun, Uniswap), route to okx-dapp-discovery instead, e.g. 'swap on PancakeSwap', 'swap SOL for USDC on Raydium', '在 Curve 上换 USDT', 'swap on Uniswap'.
okx-onchain-gateway
Onchain transaction gateway across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ chains. Invoke to broadcast a pre-signed / raw / already-signed transaction, push a serialized tx on-chain, query current gas price, estimate gas limit, simulate or dry-run a transaction before sending, track a broadcast order, or check tx-confirmed / pending status by txHash or orderId.
okx-dex-signal
Use this skill for smart-money/whale/KOL/大户 activity tracking, aggregated buy signal/信号 alerts, and leaderboard/牛人榜 rankings. Covers: (1) address tracker — raw DEX transaction feed for smart money, KOL, or custom wallet addresses; (2) aggregated buy-only signal alerts — tokens bought collectively by smart money/KOL/whales; (3) leaderboard — top traders by PnL, win rate, volume, or ROI. Use when the user asks 'what are smart money buying', '聪明钱最新交易', 'KOL交易动态', '追踪聪明钱', 'track address trades', '大户在买什么', 'whale signals', 'smart money alerts', '信号', '大户信号', 'top traders', '牛人榜', or wants to monitor notable wallet activity. Also handles Market API payment/计费/x402/402, Basic/Premium tier/quota/额度 questions, and MARKET_API_*_OVER_QUOTA / confirming:true responses on signal, leaderboard, or tracker endpoints. NOTE: if the user wants to write a WebSocket script/脚本/bot, use okx-dex-ws instead.