okx-exchange-websocket-skill
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
uxcis installed and available inPATH.- 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:
{"op":"subscribe","args":[{"channel":"tickers","instId":"BTC-USDT"}]}
Core Workflow
- 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
- Inspect sink output:
tail -n 5 $HOME/.uxc/subscriptions/okx-btcusdt-ticker.ndjson
- Query runtime status:
uxc subscribe listuxc subscribe status <job_id>
- 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
dataevent for subscription acknowledgement - repeated
dataevents carrying ticker payloads under:arg.channelarg.instIddata[0].lastdata[0].bidPxdata[0].askPxdata[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 websocketfor this skill. - Public OKX channels do not require login. Do not mix this skill with private WebSocket auth flows.
--init-frameis required because OKX public channels are multiplexed behind one endpoint.instIdvalues use OKX instrument naming such asBTC-USDT.uxc subscribe start ... --transport websocketis the intended execution path for this skill;uxc linkis not the main interface because channel selection lives in the subscribe frame.
References
- Usage patterns:
references/usage-patterns.md
- OKX WebSocket API:
More from holon-run/uxc
chrome-devtools-mcp-skill
Use Chrome DevTools MCP through UXC over local stdio for page navigation, DOM/a11y snapshots, network inspection, console inspection, and performance tooling, with a live-browser autoConnect default and optional browserUrl or isolated fallback modes.
53playwright-mcp-skill
Run browser automation through @playwright/mcp over UXC stdio MCP, with daemon-friendly session reuse and safe action guardrails. Use when tasks need deterministic page navigation, DOM snapshots, and scripted browser interaction from CLI.
49uxc
Discover and call remote schema-exposed interfaces with UXC. Use when an agent or skill needs to list operations, inspect operation schemas, and execute OpenAPI, GraphQL, gRPC, MCP, or JSON-RPC calls via one CLI contract.
44dune-mcp-skill
Use Dune MCP through UXC for blockchain table discovery, SQL query creation/execution, execution result retrieval, and visualization with help-first schema inspection, explicit auth binding, and guarded credit-consuming operations.
28context7-mcp-skill
Query up-to-date library documentation and code examples using Context7 MCP. Use when you need current, version-specific documentation for npm packages, Python libraries, or other programming languages.
26deepwiki-mcp-skill
Ask questions and read documentation about any GitHub repository using DeepWiki MCP. Use when you need to understand a codebase, find specific APIs, or get context about a repository.
25