okx-dex-ws
Original:🇺🇸 English
Translated
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).
323installs
Sourceokx/onchainos-skills
Added on
NPX Install
npx skill4agent add okx/onchainos-skills okx-dex-wsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Onchain OS DEX WebSocket — Unified Skill
Two ways to consume real-time DEX data:
- CLI () — start a background session, poll events incrementally. Best for monitoring and agent-driven workflows.
onchainos ws - Script — write a custom WebSocket client in Python/Node/Rust. Best for bots and custom logic.
Pre-flight Checks
Read. If that file does not exist, read../okx-agentic-wallet/_shared/preflight.mdinstead._shared/preflight.md
Prerequisites
This skill requires co-installation with , , , and (all included in the onchainos-skills repository).
okx-dex-marketokx-dex-tokenokx-dex-signalokx-dex-trenchesApproach 1: CLI (onchainos ws
)
onchainos wsDiscover Channels
onchainos ws channels # list all 9 supported channels
onchainos ws channel-info --channel <name> # detailed info + example for a channelStart / 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 |
|---|---|---|---|
| signal | global | (none) |
| signal | per-wallet | |
| signal | per-chain | |
| market | per-token | |
| market | per-token | |
| token | per-token | |
| token | per-token | |
| trenches | per-chain | |
| trenches | per-chain | |
Parameter Formats
- :
--token-pair(e.g.chainIndex:tokenContractAddress)1:0xdac17f958d2ee523a2206206994597c13d831ec7 - : comma-separated chain IDs (e.g.
--chain-index)1,501,56 - : comma-separated addresses, max 200
--wallet-addresses - : auto-stop if no poll within this duration (default
--idle-timeout;30m,1h,2h,300sto disable)0
Examples
bash
# 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:0xdac17f958d2ee523a2206206994597c13d831ec7Poll Filters (tracker channels only)
When polling or , these filters are available:
kol_smartmoney-tracker-activityaddress-tracker-activity- ,
--min-quote-amount,--min-market-cap--min-pnl - (wallet address prefix match)
--trader - (smart_money or kol)
--tag - (buy or sell)
--trade-type - (ms timestamp)
--since
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.mdChannels: ,
pricedex-token-candle{period}Token Data (detailed token streams)
Read:
../okx-dex-token/references/ws-protocol.mdChannels: ,
price-infotradesSignal & Wallet Tracking
Read:
../okx-dex-signal/references/ws-protocol.mdChannels: , ,
dex-market-new-signal-openapikol_smartmoney-tracker-activityaddress-tracker-activityMeme/Trenches
Read:
../okx-dex-trenches/references/ws-protocol.mdChannels: ,
dex-market-memepump-new-token-openapidex-market-memepump-update-metrics-openapiCommon Protocol (all channels share)
- Endpoint:
wss://wsdex.okx.com/ws/v6/dex - Auth: HMAC-SHA256 login required before subscribing
- Heartbeat: send every 25s, expect
"ping""pong" - Subscribe:
{"op": "subscribe", "args": [...]} - Unsubscribe:
{"op": "unsubscribe", "args": [...]}