npx skills add ...
npx skills add okx/agent-skills --skill okx-outcomes
Use this skill for OKX Outcomes markets (YES/NO event contracts, formerly OKX Predictions) via the okx-outcomes binary. Triggers: 'list prediction events', '预测市场', 'event detail', 'place prediction order', '预测下单', 'buy YES', 'buy NO', '撤单 预测', 'split xp', '拆分 xp', 'merge YES NO', '赎回 预测', 'prediction positions', '预测持仓', 'live prediction price', '预测行情', 'OHLCV candles', 'K线', 'CTF', 'polymarket'. Auth: OAuth sign-in via 'okx outcomes auth login'; writes need a signing key configured by 'okx outcomes setup'. Do NOT use for OKX CEX event contracts (use okx-cex-trade event), spot/swap/futures (okx-cex-trade), crypto market data (okx-cex-market), or CEX portfolio (okx-cex-portfolio). Namespace required: account: balance/positions/order/orders/trades; clob: price/prices/midpoint/midpoints/spread/spreads/book/books; data: events/event/event-markets/market/trending/ticker/candles; ctf: split/merge/redeem; wallet: show; auth: login/refresh/status; setup: status/region/bind.
npx skills add okx/agent-skills --skill okx-outcomes
Binary-outcome (YES / NO) event-contract trading via the external okx-outcomes binary (formerly OKX Prediction Markets / okx-predict), wrapped under okx outcomes <command>.
../_shared/preflight.md Step 1 only (main CLI auto-upgrade). Steps 2 and 3 (OAuth/API-key detection, version drift) do not apply — Outcomes markets use an independent credential set.okx-outcomes binary is reachable:
Error: okx-outcomes binary not found in PATH, install it first (see Prerequisites).Configuration is stored in ~/.okx-outcomes/config.json (non-secret) and the OS
keyring (secrets; encrypted ~/.okx-outcomes/keyring.enc fallback). There is no
.env auto-loading — PREDICTIONS_* environment variables, if set, only override
the stored values.
| Var | Used for | Notes |
|---|---|---|
PREDICTIONS_AGENT_PRIVATE_KEY | On-chain writes (clob create-order / cancel / ctf *) | secp256k1 hex. Normally generated by okx outcomes setup and stored in the keyring — this env var only overrides it. NEVER share or print. |
PREDICTIONS_API_BASE | REST host override | Defaults to the region picked during setup |
OKX_OUTCOMES_BIN | Binary path override | Useful for local dev builds |
Security: NEVER accept the signing private key in chat. The wallet is created by
okx outcomes setup/setup bindand stored in the keyring. If the user pastes a key anyway, refuse and tell them to revoke / rotate it.
Naming note: env vars still use the
PREDICTIONS_*prefix (upstream legacy naming) even after the product rebrand to OKX Outcomes.
Outcomes markets use OKX OAuth sign-in for authenticated reads and an EIP-712
signing key for on-chain writes. These are not related to the main okx CLI's
OAuth / API-key flow — do NOT call okx auth login for outcomes; outcomes has its own
okx outcomes auth login.
| Operation class | Example commands | Credential |
|---|---|---|
| Public data | data events/event/market/ticker/candles, clob price/prices/midpoint/spread/book/books | none |
| Authenticated reads | account balance/order/orders/positions/trades (closed = positions --status closed), search, status | OAuth session (okx outcomes auth login) |
| On-chain writes | clob create-order / market-order / cancel-oid / cancel-all / heartbeat, ctf split / merge / redeem, wallet show | signing key (keyring agent_private_key, or PREDICTIONS_AGENT_PRIVATE_KEY) |
Setup can be completed entirely from the agent — no terminal required. The user only ever acts in a browser (open a URL + enter a code, and open a bind short link — which launches the OKX app on a phone, or opens a web fallback in any browser); the agent runs every command.
First-time setup has three pieces, in dependency order: (1) region, (2) OAuth sign-in, (3) EOA wallet binding. Detect progress with:
Then advance the next_step:
Region — okx outcomes setup region <global|us> (non-interactive; agent runs it).
OAuth sign-in (device-code) — okx outcomes auth login --manual --json. This prints a one-line {verificationUri, userCode, expiresIn} envelope and exits immediately (it does not block or read stdin). Relay it to the user: "Open <verificationUri> on any device and enter code <userCode> (valid ~N min)." After they authorize in the browser, verify with okx outcomes auth refresh --json (writes the session marker on success) — poll a few times with backoff, or run once after the user says they're done.
Wallet binding — okx outcomes setup bind --json (agent runs it): generates the signing wallet and prints the wallet address plus a short link (the deeplink field of the JSON output) of the form https://okx.com/ul/3OauBX?eoa=<eoa>&uid=<uid> (the eoa is the new wallet's public address and uid is the signed-in account id — both filled in by the CLI). Surface the short link verbatim (do not shorten or wrap it) and tell the user three things: (a) tapping it on their phone launches the OKX app to approve the binding, (b) they can also copy it into any browser, and (c) if the link won't open, copy the wallet address shown above and bind it manually in the OKX app: Outcomes → Profile → Settings → API Bind Wallet. To re-display without rotating the wallet, use setup bind --keep (plain setup bind regenerates a fresh wallet every time).
Surface template — relay verbatim (Chinese):
English equivalent:
The address is public — safe to show. The signing key behind it never leaves the local keyring.
Re-run setup status --json after each step, then okx outcomes status once complete: true.
The okx outcomes wrapper spawns the binary with inherited stdio, so the agent's
captured stdout receives each command's output. All per-step setup commands are
agent-runnable:
setup status, setup region, auth login --manual --json, auth refresh, auth status, setup bind (relay the bind short link; the user opens it on their phone or pastes it into a browser).okx outcomes setup wizard and okx outcomes shell REPL — both use raw-terminal input and will hang / EOF-error without a TTY. Use the per-step subcommands above instead.The plain
okx outcomes auth login(no--manual) is the interactive/browser-foreground variant for a user at a real terminal; agents must use--manual.
okx-cex-trade (use okx event ...)okx-cex-tradeokx-cex-marketokx-cex-portfolioFlag placement: put flags after the subcommand (
okx outcomes events --json) or before the module (okx --json outcomes events).okx outcomes --json events— a flag wedged between the module and its subcommand — is not supported.
| # | Command | Auth | Description |
|---|---|---|---|
| 1 | okx outcomes data events [--status active] [--category <c>] [--limit <n>] | none | List outcome events |
| 2 | okx outcomes data event <eventId> | none | Single event detail |
| 3 | okx outcomes data event-markets <eventId> | none | Event + all its markets (includes YES/NO asset ids) |
| 4 | okx outcomes data market <marketId> | none | Single market detail |
| 5 | okx outcomes data trending | none | Trending events |
| 6 | okx outcomes data ticker <assetId> | none | 24h ticker for one outcome asset |
| 7 | okx outcomes data candles <assetId> [--bar 1H] [--limit 100] | none | OHLCV candles |
| 8 | okx outcomes search <keyword> | OAuth | Keyword search |
| 9 | okx outcomes clob price --asset <id> [--outcome yes|no] | none | Trimmed price (last/bid/ask/mid/spread) |
| 10 | okx outcomes clob prices <id1> <id2> ... | none | Batch price view |
| 11 | okx outcomes clob midpoint --asset <id> / clob midpoints <ids...> | none | (bid+ask)/2 |
| 12 | okx outcomes clob spread --asset <id> / clob spreads <ids...> | none | Bid/ask spread |
| 13 | okx outcomes clob book --asset <id> [--sz <n>] / clob books <ids...> | none | Multi-level depth (default sz=10, max 400) |
| 14 | okx outcomes account balance | OAuth | Account balance |
| 15 | okx outcomes account order <orderId> | OAuth | Single order detail |
| 16 | okx outcomes account orders | OAuth | Open orders |
| 17 | okx outcomes account positions | OAuth | Open positions (look for status="Won" → redeem) |
| 18 | okx outcomes account positions --status closed | OAuth | Closed positions + realized PnL |
| 19 | okx outcomes account trades | OAuth | Trade history |
| 20 | okx outcomes wallet show | signing | Derived wallet address |
| 21 | okx outcomes status | OAuth | Health check |
| 22 | okx outcomes auth status [--json] | none | OAuth session state |
| 23 | okx outcomes setup status [--json] | none | Onboarding progress (region/oauth/binding) |
| Command | Auth | Description | Agent-runnable? |
|---|---|---|---|
okx outcomes setup region <global|us> | none | Set region (step 1) | ✅ yes |
okx outcomes auth login --manual --json | none | OAuth device-code (step 2): prints {verificationUri,userCode,expiresIn} and exits | ✅ yes (relay URL+code to user) |
okx outcomes auth refresh [--json] | none | Verify/refresh session after the user authorizes (writes session marker) | ✅ yes |
okx outcomes setup bind [--keep] --json | signing | Bind EOA wallet (step 3): prints address + a short link (deeplink field, https://okx.com/ul/3OauBX?eoa=…&uid=…); --keep reuses existing wallet | ✅ yes (user opens the short link, or copies the address to bind manually) |
okx outcomes auth login --site <global|us> | none | Interactive/browser-foreground sign-in (for a user at a real terminal) | 🚫 needs a TTY |
okx outcomes setup / okx outcomes shell | — | Full interactive wizard / REPL | 🚫 needs a TTY |
| # | Command | Risk |
|---|---|---|
| 24 | okx outcomes clob create-order --asset <id> --side buy|sell --price --size [--tif gtc|gtd|ioc|fok|alo] [--expiry <ms>] [--size-type base|quote] | High |
| 25 | okx outcomes clob market-order --asset <id> --side buy|sell --size [--tif ioc|fok] [--size-type base|quote] | High (immediate cross) |
| 26 | okx outcomes clob cancel-oid --oid <id> --asset <id> | Medium |
| 27 | okx outcomes clob cancel-all | High |
| 28 | okx outcomes clob heartbeat | Medium (5-min dead-man auto cancel-all) |
| 29 | okx outcomes ctf split --market <id> --amount <xp> | High (locks xp) |
| 30 | okx outcomes ctf merge --market <id> --amount <xp> | High |
| 31 | okx outcomes ctf redeem --market <id> | High (burns full winning balance) |
Aliases:
clob order/orders/tradesdelegate to the correspondingaccount *commands. Preferaccount *in skill output for clarity.
curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh.status returns auth errors, the user isn't signed in — check okx outcomes auth status --json and guide them through "Setup & Onboarding" (auth login).okx outcomes auth status --json); otherwise route to "Setup & Onboarding".Before executing any clob create-order / clob market-order / clob cancel-* / clob cancel-all / ctf * command, render a dry-run summary first:
The summary fields:
okx outcomes data market <marketId> (look up marketId from the asset's parent market)assetId from event-markets <eventId> plus which outcome (YES / NO) it representsprice * size (xp)okx outcomes wallet show --jsonokx outcomes account balance --json → row where oddsType="spots", available fieldOnly after the user replies confirm do you run the real command. If anything else (including silence), abort.
After execution, immediately verify state:
Report the resulting order id / tx hash to the user.
Detailed parameter tables and examples per command group:
references/setup-auth.md — setup status/region/bind, auth login/refresh/status, config & keyring storage, non-TTY rulesreferences/data-commands.md — events / event / market / trending / ticker / candles / searchreferences/account-commands.md — account balance / orders / positions / tradesreferences/clob-commands.md — clob price / order / orders / trades / create-order / cancel / cancel-all / heartbeatreferences/ctf-commands.md — ctf split / merge / redeemreferences/workflows.md — first-time setup / daily brief / event deep-dive / portfolio check / safe place-order / resolve-and-redeemThis module does not expose any MCP tools in the current release. Agents invoke okx outcomes <command> directly via Bash. A future MCP server may be provided independently by the outcomes team.
okx-outcomes not in PATH: wrapper prints install hint and exits 127. Tell the user to run curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh.clob create-order / market-order / ctf * will fail. Run okx outcomes setup bind --json (agent-runnable), relay the short link (deeplink field, https://okx.com/ul/3OauBX?eoa=…&uid=…), and have the user open it (tap on phone → OKX app, or copy into a browser); if the link won't open, have them copy the wallet address and bind it manually in the OKX app (Outcomes → Profile → Settings → API Bind Wallet) — never ask for the key in chat.clob price/book/create-order/market-order need assetId; ctf * and account trades --market need marketId. When unsure, run event-markets <eventId> first — its output lists both.--tif gtd without --expiry: rejected client-side. Pair them or default to gtc.--size-type quote outside buy + ioc: rejected client-side (create-order). Tell the user up front that "spend N points" syntax requires buy + IOC.clob market-order --tif fok is rejected client-side when visible depth is insufficient — no signed message sent. Surface the rejection and suggest reducing --size or using --tif ioc.okx outcomes status reports it.--json when piping into other tools or summarizing — the wrapper auto-appends --json if the user is in --json mode globally.[0,1]), notionals, and CTF amounts are xp.PREDICTIONS_AGENT_PRIVATE_KEY (or any 0x followed by 64 hex chars) to chat. If you must reference it, mask as 0x****. Do not write it to memory.--side buy / --side sell (write commands). account trades --side accepts BUY / SELL (uppercase) — the inconsistency is upstream, follow each command's signature.429 / rate-limit errors, back off and retry after the suggested wait.okx outcomes <cmd> forwards verbatim to okx-outcomes. Refer to okx/outcomes-cli docs/cli-reference.md for the canonical binary documentation.OKX_OUTCOMES_BIN env var can override the binary path (useful for local development with a cargo build --release artifact).