PluginBench
Skill
Review
Audit score 70

okx-dex-ws

okx/onchainos-skills

Manage real-time DEX WebSocket sessions and subscribe to 9 on-chain data channels via CLI or custom scripts.

What is okx-dex-ws?

This skill provides CLI commands and protocol references for consuming real-time DEX market data, token info, signals, and wallet tracking through WebSocket channels. Use it when you need to monitor price feeds, candles, trades, smart money activity, or meme token launches with low-latency updates.

  • Start, poll, and stop background WebSocket sessions with `onchainos ws` CLI commands
  • Subscribe to 9 DEX channels: price, candles, trades, price-info, signals, smart money tracker, wallet tracker, and meme token scanning
  • Configure idle-timeout to auto-stop inactive sessions (default 30m)
  • Filter tracker events by min-quote-amount, min-market-cap, min-pnl, trader address, tag, trade-type, and timestamp
  • Build custom WebSocket clients in Python/Node/Rust using protocol references for market, token, signal, and trenches data
  • List active sessions and retrieve detailed channel metadata with examples

How to install okx-dex-ws

npx skills add https://github.com/okx/onchainos-skills --skill okx-dex-ws
Prerequisites
  • okx-dex-market, okx-dex-token, okx-dex-signal, and okx-dex-trenches skills installed (for protocol references)
  • HMAC-SHA256 credentials for WebSocket authentication
  • onchainos CLI installed and configured
Claude Code
Cursor
Windsurf
Cline

How to use okx-dex-ws

  1. 1.Run `onchainos ws channels` to list all 9 available channels
  2. 2.Run `onchainos ws channel-info --channel <name>` to see detailed info and examples for a specific channel
  3. 3.Start a session with `onchainos ws start --channel <channel> [params]` (e.g., `--token-pair`, `--chain-index`, `--wallet-addresses`)
  4. 4.Poll new events with `onchainos ws poll --id <ID>` to incrementally fetch updates
  5. 5.Stop a session with `onchainos ws stop --id <ID>` or let it auto-stop via `--idle-timeout`
  6. 6.For custom scripts, read the protocol reference file from the related skill (okx-dex-market, okx-dex-token, okx-dex-signal, or okx-dex-trenches) and connect to `wss://wsdex.okx.com/ws/v6/dex` with HMAC-SHA256 login

Use cases

Good for
  • Monitor smart money trades and KOL activity in real-time across multiple chains
  • Track price and candle updates for specific token pairs on Ethereum, Solana, or other chains
  • Alert on new buy signals or meme token launches as they occur on-chain
  • Build a bot that polls wallet activity for specific addresses and filters by PnL or trade size
  • Stream detailed trade and price-info data for custom analytics or risk monitoring
Who it's for
  • On-chain traders and portfolio managers monitoring real-time market data
  • Bot developers building custom WebSocket clients for automated trading or alerts
  • Agents and workflows requiring low-latency DEX event feeds
  • Researchers tracking smart money and KOL activity patterns

okx-dex-ws FAQ

What's the difference between CLI and custom script approaches?

CLI (`onchainos ws`) is best for monitoring and agent workflows—start a session, poll incrementally, set idle-timeout. Custom scripts are best for bots with custom logic—you write the WebSocket client directly using the protocol references.

How do I filter tracker events?

When polling `kol_smartmoney-tracker-activity` or `address-tracker-activity`, use flags like `--min-quote-amount`, `--min-market-cap`, `--min-pnl`, `--trader`, `--tag`, `--trade-type`, and `--since`.

What happens if a referenced skill is not installed?

If okx-dex-market, okx-dex-token, okx-dex-signal, or okx-dex-trenches is missing, the corresponding protocol reference file won't be found. Inform the user and suggest installing the missing skill from onchainos-skills.

What is idle-timeout and how do I configure it?

idle-timeout auto-stops a session if no poll occurs within the specified duration (default 30m). Set it with `--idle-timeout 1h`, `300s`, or `0` to disable.

Which channels require which parameters?

Global channels (kol_smartmoney-tracker-activity) need no params. Per-wallet channels need `--wallet-addresses`. Per-token channels need `--token-pair`. Per-chain channels need `--chain-index`.

Full 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:

  1. CLI (onchainos ws) — start a background session, poll events incrementally. Best for monitoring and agent-driven workflows.
  2. 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.md instead.

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:

CommandWorkflowFile
ws start, ws poll, ws stopWallet 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

ChannelGroupPatternRequired Params
kol_smartmoney-tracker-activitysignalglobal(none)
address-tracker-activitysignalper-wallet--wallet-addresses
dex-market-new-signal-openapisignalper-chain--chain-index
pricemarketper-token--token-pair
dex-token-candle{period}marketper-token--token-pair
price-infotokenper-token--token-pair
tradestokenper-token--token-pair
dex-market-memepump-new-token-openapitrenchesper-chain--chain-index
dex-market-memepump-update-metrics-openapitrenchesper-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 (default 30m; 1h, 2h, 300s, 0 to 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": [...]}