okx-outcomes
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOKX Outcomes CLI
OKX Outcomes CLI
Binary-outcome (YES / NO) event-contract trading via the external binary (formerly OKX Prediction Markets / ), wrapped under .
okx-outcomesokx-predictokx outcomes <command>通过外部二进制文件(前身为OKX Prediction Markets / )进行二元结果(YES / NO)事件合约交易,包装为命令形式。
okx-outcomesokx-predictokx outcomes <command>Preflight
预检查
- Run 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.
../_shared/preflight.md - Confirm binary is reachable:
okx-outcomesIf you seebashokx outcomes status, install it first (see Prerequisites).Error: okx-outcomes binary not found in PATH
- 仅运行中的步骤1(主CLI自动升级)。步骤2和3(OAuth/API密钥检测、版本差异)不适用——Outcomes市场使用独立的凭证集。
../_shared/preflight.md - 确认二进制文件可访问:
okx-outcomes如果看到bashokx outcomes status,请先安装它(参见前提条件)。Error: okx-outcomes binary not found in PATH
Prerequisites
前提条件
bash
undefinedbash
undefined1. Main OKX CLI (provides the okx outcomes
wrapper command)
okx outcomes1. 主OKX CLI(提供okx outcomes
包装命令)
okx outcomesnpm install -g @okx_ai/okx-trade-cli
npm install -g @okx_ai/okx-trade-cli
2. Outcomes binary
2. Outcomes二进制文件
macOS / Linux:
macOS / Linux:
Windows: download okx-outcomes.exe from https://github.com/okx/outcomes-cli/releases
and place it on your PATH.
并将其放置在PATH路径中。
3. First-time setup — sign in + bind wallet.
3. 首次设置——登录+绑定钱包。
In a real terminal you can run the full interactive wizard:
在真实终端中,您可以运行完整的交互式向导:
okx outcomes setup
okx outcomes setup
In an agent / chat context, drive it step-by-step instead — see
在Agent/聊天环境中,请逐步完成设置——请参阅
"Setup & Onboarding" below (the full wizard needs a TTY and cannot be
下方的“设置与入门”(完整向导需要TTY,无法从Agent启动)。
spawned from an agent).
4. 验证
4. Verify
—
okx outcomes status
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.okx outcomes status
配置存储在`~/.okx-outcomes/config.json`(非机密)和操作系统密钥环(机密;加密的`~/.okx-outcomes/keyring.enc`作为备选)。**不支持`.env`自动加载**——如果设置了`PREDICTIONS_*`环境变量,它们仅会覆盖存储的值。Environment variables (optional overrides)
环境变量(可选覆盖)
| Var | Used for | Notes |
|---|---|---|
| On-chain writes (clob create-order / cancel / ctf *) | secp256k1 hex. Normally generated by |
| REST host override | Defaults to the region picked during setup |
| Binary path override | Useful for local dev builds |
Security: NEVER accept the signing private key in chat. The wallet is created by/okx outcomes setupand stored in the keyring. If the user pastes a key anyway, refuse and tell them to revoke / rotate it.setup bind
Naming note: env vars still use theprefix (upstream legacy naming) even after the product rebrand to OKX Outcomes.PREDICTIONS_*
| 变量名 | 用途 | 说明 |
|---|---|---|
| 链上写入操作(clob创建订单/撤单/ctf *) | secp256k1十六进制字符串。通常由 |
| REST主机地址覆盖 | 默认值为设置期间选择的区域 |
| 二进制文件路径覆盖 | 对本地开发构建很有用 |
安全提示:切勿在聊天中接收签名私钥。钱包由/okx outcomes setup创建并存储在密钥环中。如果用户粘贴了密钥,请拒绝并告知他们撤销/轮换密钥。setup bind
命名说明:即使产品更名为OKX Outcomes,环境变量仍使用前缀(上游遗留命名)。PREDICTIONS_*
Authentication paths
认证方式
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 CLI's
OAuth / API-key flow — do NOT call for outcomes; outcomes has its own
.
okxokx auth loginokx outcomes auth login| Operation class | Example commands | Credential |
|---|---|---|
| Public data | | none |
| Authenticated reads | | OAuth session ( |
| On-chain writes | | signing key (keyring |
Outcomes市场使用OKX OAuth登录进行已认证读取操作,使用EIP-712签名密钥进行链上写入操作。这些与主 CLI的OAuth/API密钥流程无关——请勿为Outcomes调用;Outcomes有自己的命令。
okxokx auth loginokx outcomes auth login| 操作类别 | 示例命令 | 凭证要求 |
|---|---|---|
| 公开数据 | | 无 |
| 已认证读取 | | OAuth会话( |
| 链上写入 | | 签名密钥(密钥环中的 |
Setup & Onboarding
设置与入门
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:
bash
okx outcomes setup status --json设置可完全通过Agent完成——无需终端。用户仅需在浏览器中操作(打开URL+输入验证码,打开绑定短链接——在手机上启动OKX应用,或在任意浏览器中打开网页备选);Agent运行所有命令。
首次设置包含三个步骤,按依赖顺序:(1) 区域设置,(2) OAuth登录,(3) EOA钱包绑定。使用以下命令检测进度:
bash
okx outcomes setup status --json→ { "region": {...}, "oauth": {...}, "eoa_binding": {...}, "next_step": "...", "complete": false }
→ { "region": {...}, "oauth": {...}, "eoa_binding": {...}, "next_step": "...", "complete": false }
Then advance the `next_step`:
1. **Region** — `okx outcomes setup region <global|us>` (non-interactive; agent runs it).
2. **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.
3. **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):
我刚为你新生成了一个签名钱包(私钥保存在本地 keyring,永远不会展示)。
请在手机上打开下面的短链接,在 OKX App 中批准绑定这个新钱包:
新钱包地址:<address>
绑定短链:<short link>
(也可以把短链复制到浏览器打开。如果打不开,请复制上面的新钱包地址,
在 OKX App 里手动绑定:Outcomes → Profile → Settings → API 绑定钱包,
把钱包地址粘贴进去。)
⚠️ 关于这个钱包:
• 它只用来给你的交易做签名授权,不是一个充值钱包。
• 不要往这个地址转任何币 —— 余额在你的 OKX 账户里,转到这个地址的资金无法使用、大概率找不回。
• 地址可以公开(用于绑定),但它背后的私钥永远不要外泄。
在 App 中批准后告诉我。
English equivalent:
I just generated a fresh signing wallet for you (the private key
stays in the local keyring and is never displayed). Open this short
link on your phone — it'll launch the OKX app to approve binding
this new wallet:
New wallet address: <address>
Binding short link: <short link>
(You can also copy the link into any browser. If the link won't open,
copy the wallet address above and bind it manually in the OKX app:
Outcomes → Profile → Settings → API Bind Wallet.)
⚠️ About this wallet:
• It's only used to sign your trade authorizations — it is NOT a deposit wallet.
• Do NOT send any crypto/tokens to this address. Your balance lives in your
OKX account; funds sent here are unusable and likely unrecoverable.
• The address is fine to share (it's used for binding), but the private key
behind it must never be exposed.
Tell me when you've approved it in the app.
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`.
然后推进`next_step`:
1. **区域设置** —— `okx outcomes setup region <global|us>`(非交互式;Agent运行此命令)。
2. **OAuth登录(设备码)** —— `okx outcomes auth login --manual --json`。此命令会打印单行`{verificationUri, userCode, expiresIn}`信息并**立即退出**(不会阻塞或读取标准输入)。将信息转发给用户:*“在任意设备上打开`<verificationUri>`并输入验证码`<userCode>`(有效期约N分钟)。”* 用户在浏览器中授权后,使用`okx outcomes auth refresh --json`验证(成功时会写入会话标记)——可退避重试几次,或在用户完成后运行一次。
3. **钱包绑定** —— `okx outcomes setup bind --json`(Agent运行此命令):生成签名钱包并打印钱包`address`以及一个**短链接**(JSON输出中的`deeplink`字段,格式为`https://okx.com/ul/3OauBX?eoa=<eoa>&uid=<uid>`,其中`eoa`是新钱包的公钥地址,`uid`是已登录账户ID——均由CLI填充)。**原样展示短链接**(不要缩短或换行)并告知用户三点:(a) 在手机上点击链接会启动OKX应用以批准绑定这个新钱包,(b) 也可以将链接复制到任意浏览器中打开,(c) 如果链接无法打开,请复制上面的钱包`address`并在OKX应用中手动绑定:**Outcomes → Profile → Settings → API Bind Wallet**。如需重新显示而不生成新钱包,请使用`setup bind --keep`(普通`setup bind`每次都会生成新钱包)。
**展示模板(中文)** ——原样转发:
我刚为你新生成了一个签名钱包(私钥保存在本地 keyring,永远不会展示)。
请在手机上打开下面的短链接,在 OKX App 中批准绑定这个新钱包:
新钱包地址:<address>
绑定短链:<short link>
(也可以把短链复制到浏览器打开。如果打不开,请复制上面的新钱包地址,
在 OKX App 里手动绑定:Outcomes → Profile → Settings → API 绑定钱包,
把钱包地址粘贴进去。)
⚠️ 关于这个钱包:
• 它只用来给你的交易做签名授权,不是一个充值钱包。
• 不要往这个地址转任何币 —— 余额在你的 OKX 账户里,转到这个地址的资金无法使用、大概率找不回。
• 地址可以公开(用于绑定),但它背后的私钥永远不要外泄。
在 App 中批准后告诉我。
英文版本:
I just generated a fresh signing wallet for you (the private key
stays in the local keyring and is never displayed). Open this short
link on your phone — it'll launch the OKX app to approve binding
this new wallet:
New wallet address: <address>
Binding short link: <short link>
(You can also copy the link into any browser. If the link won't open,
copy the wallet address above and bind it manually in the OKX app:
Outcomes → Profile → Settings → API Bind Wallet.)
⚠️ About this wallet:
• It's only used to sign your trade authorizations — it is NOT a deposit wallet.
• Do NOT send any crypto/tokens to this address. Your balance lives in your
OKX account; funds sent here are unusable and likely unrecoverable.
• The address is fine to share (it's used for binding), but the private key
behind it must never be exposed.
Tell me when you've approved it in the app.
`address`是公开的——可以安全展示。其背后的签名密钥永远不会离开本地密钥环。
每完成一步后重新运行`setup status --json`,当`complete: true`时运行`okx outcomes status`。Non-TTY / agent environments
非TTY/Agent环境
The 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:
okx outcomes- ✅ Agent runs directly: ,
setup status,setup region,auth login --manual --json,auth refresh,auth status(relay the bind short link; the user opens it on their phone or pastes it into a browser).setup bind - 🙋 User action is browser/phone only (never a command): authorize the device-code URL in a browser; open the bind short link (tap on phone → OKX app, or paste into a browser); if it won't open, copy the wallet address and bind manually in the OKX app.
- 🚫 Never spawn from an agent: the full interactive wizard and
okx outcomes setupREPL — both use raw-terminal input and will hang / EOF-error without a TTY. Use the per-step subcommands above instead.okx outcomes shell
The plain(nookx outcomes auth login) is the interactive/browser-foreground variant for a user at a real terminal; agents must use--manual.--manual
okx outcomes- ✅ Agent直接运行:、
setup status、setup region、auth login --manual --json、auth refresh、auth status(转发绑定短链接;用户在手机或浏览器中打开)。setup bind - 🙋 用户仅需在浏览器/手机操作(无需执行命令):在浏览器中授权设备码URL;打开绑定短链接(手机点击→OKX应用,或粘贴到浏览器);如果链接无法打开,复制钱包地址并在OKX应用中手动绑定。
- 🚫 切勿从Agent启动:完整交互式向导和
okx outcomes setupREPL——两者均使用原始终端输入,若无TTY会挂起/报EOF错误。请改用上述分步子命令。okx outcomes shell
普通(不带okx outcomes auth login)是针对真实终端用户的交互式/前台浏览器版本;Agent必须使用--manual。--manual
Skill Routing
技能路由
- YES/NO event-contract outcomes markets → this skill
- OKX CEX Up/Down event contracts (different product) → (use
okx-cex-trade)okx event ... - Crypto spot/swap/futures/options →
okx-cex-trade - Crypto market data (price, candles for BTC/ETH etc.) →
okx-cex-market - CEX portfolio →
okx-cex-portfolio
- YES/NO事件合约Outcomes市场 → 本技能
- OKX CEX涨跌事件合约(不同产品) → (使用
okx-cex-trade)okx event ... - 加密货币现货/永续合约/期货/期权 →
okx-cex-trade - 加密货币市场数据(BTC/ETH等的价格、K线) →
okx-cex-market - CEX投资组合 →
okx-cex-portfolio
Quickstart
快速入门
bash
undefinedbash
undefinedHealth check
健康检查
okx outcomes status
okx outcomes status
Browse active events
浏览活跃事件
okx outcomes data events --status active --limit 10
okx outcomes data events --status active --limit 10
Drill into one event with all its markets (returns YES + NO asset ids per market)
深入查看单个事件及其所有市场(返回每个市场的YES + NO资产ID)
okx outcomes data event-markets <eventId>
okx outcomes data event-markets <eventId>
Live price for a YES outcome
YES结果的实时价格
okx outcomes clob price --asset <yesAssetId>
okx outcomes clob price --asset <yesAssetId>
Top-of-book depth
最优报价深度
okx outcomes clob book --asset <yesAssetId> --sz 5
okx outcomes clob book --asset <yesAssetId> --sz 5
My account balance / positions
我的账户余额/持仓
okx outcomes account balance
okx outcomes account positions
okx outcomes account balance
okx outcomes account positions
Place an order (ALWAYS dry-run first — see Operation Flow)
下单(请始终先进行试运行——参见操作流程)
okx outcomes clob create-order --asset <assetId> --side buy --price 0.55 --size 100
> **Flag 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.okx outcomes clob create-order --asset <assetId> --side buy --price 0.55 --size 100
> **参数位置**:参数放在子命令之后(`okx outcomes events --json`)或模块之前(`okx --json outcomes events`)。`okx outcomes --json events`——参数夹在模块和子命令之间——不被支持。Command Index
命令索引
Read commands (no gating)
读取命令(无权限限制)
| # | Command | Auth | Description |
|---|---|---|---|
| 1 | | none | List outcome events |
| 2 | | none | Single event detail |
| 3 | | none | Event + all its markets (includes YES/NO asset ids) |
| 4 | | none | Single market detail |
| 5 | | none | Trending events |
| 6 | | none | 24h ticker for one outcome asset |
| 7 | | none | OHLCV candles |
| 8 | | OAuth | Keyword search |
| 9 | | none | Trimmed price (last/bid/ask/mid/spread) |
| 10 | | none | Batch price view |
| 11 | | none | (bid+ask)/2 |
| 12 | | none | Bid/ask spread |
| 13 | | none | Multi-level depth (default sz=10, max 400) |
| 14 | | OAuth | Account balance |
| 15 | | OAuth | Single order detail |
| 16 | | OAuth | Open orders |
| 17 | | OAuth | Open positions (look for status="Won" → redeem) |
| 18 | | OAuth | Closed positions + realized PnL |
| 19 | | OAuth | Trade history |
| 20 | | signing | Derived wallet address |
| 21 | | OAuth | Health check |
| 22 | | none | OAuth session state |
| 23 | | none | Onboarding progress (region/oauth/binding) |
| # | 命令 | 认证要求 | 描述 |
|---|---|---|---|
| 1 | | 无 | 列出结果事件 |
| 2 | | 无 | 单个事件详情 |
| 3 | | 无 | 事件及其所有市场(包含YES/NO资产ID) |
| 4 | | 无 | 单个市场详情 |
| 5 | | 无 | 热门事件 |
| 6 | | 无 | 单个结果资产的24小时行情 |
| 7 | | 无 | OHLCV K线 |
| 8 | | OAuth | 关键词搜索 |
| 9 | | 无 | 简化价格(最新价/买价/卖价/中间价/点差) |
| 10 | | 无 | 批量价格视图 |
| 11 | | 无 | (买价+卖价)/2 |
| 12 | | 无 | 买卖点差 |
| 13 | | 无 | 多层深度(默认sz=10,最大400) |
| 14 | | OAuth | 账户余额 |
| 15 | | OAuth | 单个订单详情 |
| 16 | | OAuth | 未平仓订单 |
| 17 | | OAuth | 未平仓持仓(查找status="Won"→赎回) |
| 18 | | OAuth | 已平仓持仓+已实现盈亏 |
| 19 | | OAuth | 交易历史 |
| 20 | | 签名密钥 | 派生钱包地址 |
| 21 | | OAuth | 健康检查 |
| 22 | | 无 | OAuth会话状态 |
| 23 | | 无 | 入门进度(区域/OAuth/绑定) |
Setup / Auth commands
设置/认证命令
| Command | Auth | Description | Agent-runnable? |
|---|---|---|---|
| none | Set region (step 1) | ✅ yes |
| none | OAuth device-code (step 2): prints | ✅ yes (relay URL+code to user) |
| none | Verify/refresh session after the user authorizes (writes session marker) | ✅ yes |
| signing | Bind EOA wallet (step 3): prints address + a short link ( | ✅ yes (user opens the short link, or copies the address to bind manually) |
| none | Interactive/browser-foreground sign-in (for a user at a real terminal) | 🚫 needs a TTY |
| — | Full interactive wizard / REPL | 🚫 needs a TTY |
| 命令 | 认证要求 | 描述 | 是否可由Agent运行? |
|---|---|---|---|
| 无 | 设置区域(步骤1) | ✅ 是 |
| 无 | OAuth设备码(步骤2):打印 | ✅ 是(将URL+验证码转发给用户) |
| 无 | 用户授权后验证/刷新会话(写入会话标记) | ✅ 是 |
| 签名密钥 | 绑定EOA钱包(步骤3):打印地址+短链接( | ✅ 是(用户打开短链接,或复制地址手动绑定) |
| 无 | 交互式/前台浏览器登录(针对真实终端用户) | 🚫 需要TTY |
| — | 完整交互式向导/REPL | 🚫 需要TTY |
Write commands (REQUIRE dry-run preview + user confirmation)
写入命令(需要试运行预览+用户确认)
| # | Command | Risk |
|---|---|---|
| 24 | | High |
| 25 | | High (immediate cross) |
| 26 | | Medium |
| 27 | | High |
| 28 | | Medium (5-min dead-man auto cancel-all) |
| 29 | | High (locks xp) |
| 30 | | High |
| 31 | | High (burns full winning balance) |
Aliases:delegate to the correspondingclob order/orders/tradescommands. Preferaccount *in skill output for clarity.account *
| # | 命令 | 风险等级 |
|---|---|---|
| 24 | | 高 |
| 25 | | 高(立即成交) |
| 26 | | 中 |
| 27 | | 高 |
| 28 | | 中(5分钟无操作自动撤单) |
| 29 | | 高(锁定xp) |
| 30 | | 高 |
| 31 | | 高(销毁全部盈利余额) |
别名:对应clob order/orders/trades命令。为清晰起见,技能输出中优先使用account *。account *
Operation Flow
操作流程
Step 0 — Binary check
步骤0 —— 二进制文件检查
bash
okx outcomes status --json- If the wrapper prints "okx-outcomes binary not found", stop and tell the user to install via .
curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh - If returns auth errors, the user isn't signed in — check
statusand guide them through "Setup & Onboarding" (okx outcomes auth status --json).auth login
bash
okx outcomes status --json- 如果包装器打印"okx-outcomes binary not found",停止操作并告知用户通过安装。
curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh - 如果返回认证错误,说明用户未登录——检查
status并引导用户完成“设置与入门”(okx outcomes auth status --json)。auth login
Step 1 — Decide what's being asked
步骤1 —— 明确用户需求
- Public data → run command directly.
- Authenticated read → check the user is signed in (); otherwise route to "Setup & Onboarding".
okx outcomes auth status --json - On-chain write → proceed to Step 2 dry-run.
- 公开数据 → 直接运行命令。
- 已认证读取 → 检查用户是否登录();否则引导至“设置与入门”。
okx outcomes auth status --json - 链上写入 → 进入步骤2试运行。
Step 2 — Dry-run preview for writes (MANDATORY)
步骤2 —— 写入操作的试运行预览(必须执行)
Before executing any / / / / command, render a dry-run summary first:
clob create-orderclob market-orderclob cancel-*clob cancel-allctf *About to execute: okx outcomes clob create-order --asset 100888000 --side buy --price 0.55 --size 100
Market : "Will BTC be above $100k by Dec 31, 2026?" (mkt_t001)
Asset : 100888000 (YES outcome)
Side : buy
Price : 0.55 xp
Size : 100 shares
TIF : gtc
Estimated notional: 55.00 xp
Wallet : 0x1234...abcd (from `wallet show`)
Available (spots): 1,234.56 xp (from `account balance`)
Reply "confirm" to execute, or "cancel" to abort.The summary fields:
- Market title — fetched via (look up
okx outcomes data market <marketId>from the asset's parent market)marketId - Asset + outcome — the numeric from
assetIdplus which outcome (YES / NO) it representsevent-markets <eventId> - Notional — (xp)
price * size - Wallet —
okx outcomes wallet show --json - Available balance — → row where
okx outcomes account balance --json,oddsType="spots"fieldavailable
Only after the user replies do you run the real command. If anything else (including silence), abort.
confirm在执行任何////命令前,先生成试运行摘要:
clob create-orderclob market-orderclob cancel-*clob cancel-allctf *即将执行:okx outcomes clob create-order --asset 100888000 --side buy --price 0.55 --size 100
市场名称 : "Will BTC be above $100k by Dec 31, 2026?" (mkt_t001)
资产ID : 100888000 (YES结果)
交易方向 : buy
价格 : 0.55 xp
数量 : 100份
有效期限 : gtc
预估名义价值 : 55.00 xp
钱包地址 : 0x1234...abcd (来自`wallet show`)
可用余额(spots): 1,234.56 xp (来自`account balance`)
回复"confirm"执行,或"cancel"取消。摘要字段说明:
- 市场标题 —— 通过获取(从资产所属市场查找
okx outcomes data market <marketId>)marketId - 资产+结果 —— 来自的数字
event-markets <eventId>及其代表的结果(YES / NO)assetId - 名义价值 —— (xp)
price * size - 钱包地址 —— 的结果
okx outcomes wallet show --json - 可用余额 —— →
okx outcomes account balance --json行的oddsType="spots"字段available
仅当用户回复时才执行真实命令。任何其他回复(包括无回复)均终止操作。
confirmStep 3 — Execute & verify
步骤3 —— 执行并验证
After execution, immediately verify state:
bash
okx outcomes account orders --json # confirm order placed / cancelled
okx outcomes account positions --json # confirm position change (for ctf)Report the resulting order id / tx hash to the user.
执行后立即验证状态:
bash
okx outcomes account orders --json # 确认订单已下单/撤单
okx outcomes account positions --json # 确认持仓变化(针对ctf操作)将生成的订单ID/交易哈希告知用户。
CLI Command Reference
CLI命令参考
Detailed parameter tables and examples per command group:
- — setup status/region/bind, auth login/refresh/status, config & keyring storage, non-TTY rules
references/setup-auth.md - — events / event / market / trending / ticker / candles / search
references/data-commands.md - — account balance / orders / positions / trades
references/account-commands.md - — clob price / order / orders / trades / create-order / cancel / cancel-all / heartbeat
references/clob-commands.md - — ctf split / merge / redeem
references/ctf-commands.md - — first-time setup / daily brief / event deep-dive / portfolio check / safe place-order / resolve-and-redeem
references/workflows.md
各命令组的详细参数表和示例:
- —— 设置状态/区域/绑定、认证登录/刷新/状态、配置与密钥环存储、非TTY规则
references/setup-auth.md - —— events / event / market / trending / ticker / candles / search
references/data-commands.md - —— account balance / orders / positions / trades
references/account-commands.md - —— clob price / order / orders / trades / create-order / cancel / cancel-all / heartbeat
references/clob-commands.md - —— ctf split / merge / redeem
references/ctf-commands.md - —— 首次设置 / 每日简报 / 事件深度分析 / 投资组合检查 / 安全下单 / 结算与赎回
references/workflows.md
MCP Tool Reference
MCP工具参考
This module does not expose any MCP tools in the current release. Agents invoke directly via Bash. A future MCP server may be provided independently by the outcomes team.
okx outcomes <command>当前版本中,本模块未暴露任何MCP工具。Agent通过Bash直接调用。Outcomes团队未来可能会独立提供MCP服务器。
okx outcomes <command>Edge Cases
边缘情况
- not in PATH: wrapper prints install hint and exits 127. Tell the user to run
okx-outcomes.curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh - Signing wallet missing: any /
clob create-order/market-orderwill fail. Runctf *(agent-runnable), relay the short link (okx outcomes setup bind --jsonfield,deeplink), 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.https://okx.com/ul/3OauBX?eoa=…&uid=… - Asset id vs market id mix-up: the most common error class. need
clob price/book/create-order/market-order;assetIdandctf *needaccount trades --market. When unsure, runmarketIdfirst — its output lists both.event-markets <eventId> - without
--tif gtd: rejected client-side. Pair them or default to--expiry.gtc - outside
--size-type quote: rejected client-side (buy + ioc). Tell the user up front that "spend N points" syntax requires buy + IOC.create-order - FOK rejected from snapshot: is rejected client-side when visible depth is insufficient — no signed message sent. Surface the rejection and suggest reducing
clob market-order --tif fokor using--size.--tif ioc - Mode confusion: there is no demo / live flag for outcomes markets. The site is selected at signup. Be aware of which deployment the user is on (mainnet vs testnet) — reports it.
okx outcomes status
- 不在PATH中:包装器会打印安装提示并以127状态码退出。告知用户运行
okx-outcomes。curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh - 签名钱包缺失:任何/
clob create-order/market-order操作都会失败。运行ctf *(可由Agent运行),转发短链接(okx outcomes setup bind --json字段,deeplink),让用户打开链接(手机点击→OKX应用,或复制到浏览器);如果链接无法打开,让用户复制钱包地址并在OKX应用中手动绑定(Outcomes → Profile → Settings → API Bind Wallet)——切勿在聊天中索要密钥。https://okx.com/ul/3OauBX?eoa=…&uid=… - 资产ID与市场ID混淆:最常见的错误类型。需要
clob price/book/create-order/market-order;assetId和ctf *需要account trades --market。不确定时先运行marketId——其输出会列出两者。event-markets <eventId> - 未搭配
--tif gtd:客户端会拒绝。请搭配使用或默认使用--expiry。gtc - 用于非buy + ioc场景:客户端会拒绝(
--size-type quote)。提前告知用户“花费N点数”语法需要buy + IOC。create-order - FOK因快照被拒绝:当可见深度不足时,会被客户端拒绝——不会发送签名消息。告知用户拒绝原因并建议减少
clob market-order --tif fok或使用--size。--tif ioc - 模式混淆:Outcomes市场没有演示/实时标志。站点在注册时选定。注意用户所处的部署环境(主网vs测试网)——会报告。
okx outcomes status
Global Notes
全局说明
- Always pass when piping into other tools or summarizing — the wrapper auto-appends
--jsonif the user is in--jsonmode globally.--json - Unit of value: outcomes markets transact in points (xp), not USDC. All balances, prices (decimal in ), notionals, and CTF amounts are xp.
[0,1] - Private key handling: NEVER echo (or any
PREDICTIONS_AGENT_PRIVATE_KEYfollowed by 64 hex chars) to chat. If you must reference it, mask as0x. Do not write it to memory.0x**** - Side is lowercase: /
--side buy(write commands).--side sellacceptsaccount trades --side/BUY(uppercase) — the inconsistency is upstream, follow each command's signature.SELL - Rate limits: authenticated endpoints follow OKX-style throttling. On / rate-limit errors, back off and retry after the suggested wait.
429 - The wrapper is transparent: every forwards verbatim to
okx outcomes <cmd>. Refer tookx-outcomesfor the canonical binary documentation.okx/outcomes-cli docs/cli-reference.md - env var can override the binary path (useful for local development with a
OKX_OUTCOMES_BINartifact).cargo build --release
- 管道传输或汇总时始终传递——如果用户全局处于
--json模式,包装器会自动追加--json。--json - 价值单位:Outcomes市场以**点数(xp)**交易,而非USDC。所有余额、价格(区间的小数)、名义价值和CTF金额均为xp。
[0,1] - 私钥处理:切勿在聊天中输出(或任何以
PREDICTIONS_AGENT_PRIVATE_KEY开头的64位十六进制字符串)。如需引用,掩码为0x。不要将其写入内存。0x**** - 交易方向为小写:/
--side buy(写入命令)。--side sell接受account trades --side/BUY(大写)——此不一致为上游问题,请遵循各命令的签名。SELL - 速率限制:已认证端点遵循OKX风格的限流规则。遇到/限流错误时,退避并在建议等待时间后重试。
429 - 包装器是透明的:每个都会原样转发给
okx outcomes <cmd>。请参考okx-outcomes获取二进制文件的官方文档。okx/outcomes-cli docs/cli-reference.md - ****环境变量可覆盖二进制文件路径(对使用
OKX_OUTCOMES_BIN产物的本地开发很有用)。cargo build --release