okx-exchange-websocket-skill
Subscribe to OKX public exchange WebSocket channels through UXC raw WebSocket mode for ticker, trade, book, and candle events with explicit subscribe frames.
Best use case
okx-exchange-websocket-skill is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Subscribe to OKX public exchange WebSocket channels through UXC raw WebSocket mode for ticker, trade, book, and candle events with explicit subscribe frames.
Teams using okx-exchange-websocket-skill should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/okx-websocket/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How okx-exchange-websocket-skill Compares
| Feature / Agent | okx-exchange-websocket-skill | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Subscribe to OKX public exchange WebSocket channels through UXC raw WebSocket mode for ticker, trade, book, and candle events with explicit subscribe frames.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# OKX Exchange WebSocket Skill
Use this skill to run OKX public exchange WebSocket channels through `uxc subscribe` raw WebSocket mode.
Reuse the `uxc` skill for generic runtime behavior, sink handling, and event-envelope parsing.
## Prerequisites
- `uxc` is installed and available in `PATH`.
- Network access to the OKX public WebSocket endpoint.
- A writable sink path for NDJSON output.
## Scope
This skill covers OKX public exchange channels such as:
- tickers
- trades
- books and books5
- candle channels
This skill does **not** cover:
- OKX OnchainOS MCP
- private WebSocket login flows
- trading, account, or order-management channels
- REST API workflows
## Endpoint Model
Use the OKX public WebSocket endpoint:
- `wss://ws.okx.com:8443/ws/v5/public`
OKX public channels require a subscribe frame after connect, for example:
```json
{"op":"subscribe","args":[{"channel":"tickers","instId":"BTC-USDT"}]}
```
## Core Workflow
1. Start a raw WebSocket subscription:
- `uxc subscribe start wss://ws.okx.com:8443/ws/v5/public --transport websocket --init-frame '{"op":"subscribe","args":[{"channel":"tickers","instId":"BTC-USDT"}]}' --sink file:$HOME/.uxc/subscriptions/okx-btcusdt-ticker.ndjson`
2. Inspect sink output:
- `tail -n 5 $HOME/.uxc/subscriptions/okx-btcusdt-ticker.ndjson`
3. Query runtime status:
- `uxc subscribe list`
- `uxc subscribe status <job_id>`
4. Stop the job when finished:
- `uxc subscribe stop <job_id>`
## Common Subscribe Frames
- tickers:
- `{"op":"subscribe","args":[{"channel":"tickers","instId":"BTC-USDT"}]}`
- trades:
- `{"op":"subscribe","args":[{"channel":"trades","instId":"BTC-USDT"}]}`
- books5:
- `{"op":"subscribe","args":[{"channel":"books5","instId":"BTC-USDT"}]}`
- candles:
- `{"op":"subscribe","args":[{"channel":"candle1m","instId":"BTC-USDT"}]}`
## Runtime Validation
The following live raw WebSocket flow has been validated successfully through `uxc`:
- endpoint: `wss://ws.okx.com:8443/ws/v5/public`
- transport: `--transport websocket`
- init frame:
- `{"op":"subscribe","args":[{"channel":"tickers","instId":"BTC-USDT"}]}`
Observed sink behavior:
- initial `open`
- JSON `data` event for subscription acknowledgement
- repeated `data` events carrying ticker payloads under:
- `arg.channel`
- `arg.instId`
- `data[0].last`
- `data[0].bidPx`
- `data[0].askPx`
- `data[0].ts`
## Guardrails
- Keep automation on the JSON output envelope; do not use `--text`.
- Parse stable event fields first: `event_kind`, `data`, `meta`.
- Always pass `--transport websocket` for this skill.
- Public OKX channels do not require login. Do not mix this skill with private WebSocket auth flows.
- `--init-frame` is required because OKX public channels are multiplexed behind one endpoint.
- `instId` values use OKX instrument naming such as `BTC-USDT`.
- `uxc subscribe start ... --transport websocket` is the intended execution path for this skill; `uxc link` is not the main interface because channel selection lives in the subscribe frame.
## References
- Usage patterns:
- `references/usage-patterns.md`
- OKX WebSocket API:
- https://www.okx.com/docs-v5/en/Related Skills
gate-exchange-trading-copilot
End-to-end cryptocurrency trading copilot for Gate Exchange. Use this skill whenever the user wants one skill to complete market judgment, risk control, and execution for a cryptocurrency trade on Gate Exchange. Trigger phrases include "analyze before placing an order", "analyze before buying", "check risk before trading", or any request involving cryptocurrency trade judgment, order drafting, spot or futures execution, or post-trade management on Gate Exchange.
gate-exchange-staking
The on-chain staking query function of Gate Exchange. Use this skill to query staking positions, rewards, products, or order history. Trigger phrases include: staking, stake, earn, staking rewards, staking positions, earning records, staking history, available coins.
gate-exchange-marketanalysis
The market analysis function of Gate Exchange, such as liquidity, momentum, liquidation, funding arbitrage, basis, manipulation risk, order book explainer, slippage simulation. Use when the user asks about liquidity, depth, slippage, buy/sell pressure, liquidation, funding rate arbitrage, basis/premium, manipulation risk, order book explanation, or slippage simulation (e.g. market buy $X slippage). Trigger phrases: liquidity, depth, slippage, momentum, buy/sell pressure, liquidation, squeeze, funding rate, arbitrage, basis, premium, manipulation, order book, spread, slippage simulation.
gate-exchange-assets
Gate Exchange asset and balance query skill. Use when user asks to check total assets, account balance, specific currency holdings, or sub-account assets (spot, futures, margin, options, finance, Alpha, TradFi). Trigger phrases: 'how much do I have', 'total assets', 'account balance', 'how many BTC', 'spot balance', 'futures account', 'margin account', 'options account', 'finance account', 'Alpha account', 'TradFi account'. Read-only, no trading.
binance-spot-websocket-skill
Subscribe to Binance Spot public market streams through UXC raw WebSocket support for trades, book ticker, depth, and ticker events with stream-specific guardrails.
cmc-api-exchange
API reference for CoinMarketCap exchange endpoints including exchange info, volume, market pairs, and assets. Use this skill whenever the user mentions exchange API, asks about exchange volumes, wants trading pair data, needs proof-of-reserves info, or is building exchange integrations. This is the authoritative reference for CMC exchange API questions. Trigger: "exchange API", "CMC exchange data", "trading pairs API", "exchange volume API", "/cmc-api-exchange"
virtual-exchange
Virtual crypto exchange for AI agents - spot, futures (1-125x), AMM trading with Python SDK and OpenClaw skill
trust-city-exchange
Trust-gated autonomous job marketplace with plugin-agent onboarding and ERC-8004 receipts.
8004-skill
ERC-8004 Trustless Agents - Register and manage AI agent identities on TRON and BSC blockchains with on-chain reputation tracking
8004-MCP - Agent Registry Protocol
Multi-chain MCP server for ERC-8004 Agent Registry. Query agents, reputation, and feedback across Solana + EVM chains.
supurr
Backtest, deploy, and monitor trading bots on Hyperliquid. Supports Grid, DCA, and Spot-Perp Arbitrage strategies across Native Perps, Spot markets (USDC/USDH), and HIP-3 sub-DEXes.
senpi-skills
Agent Skills for autonomous crypto trading on Hyperliquid — trailing stops, market scanning, position management, and more.