okx-outcomes

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OKX Outcomes CLI

OKX Outcomes CLI

Binary-outcome (YES / NO) event-contract trading via the external
okx-outcomes
binary (formerly OKX Prediction Markets /
okx-predict
), wrapped under
okx outcomes <command>
.
通过外部
okx-outcomes
二进制文件(前身为OKX Prediction Markets /
okx-predict
)进行二元结果(YES / NO)事件合约交易,包装为
okx outcomes <command>
命令形式。

Preflight

预检查

  1. Run
    ../_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.
  2. Confirm
    okx-outcomes
    binary is reachable:
    bash
    okx outcomes status
    If you see
    Error: okx-outcomes binary not found in PATH
    , install it first (see Prerequisites).
  1. 仅运行
    ../_shared/preflight.md
    中的步骤1(主CLI自动升级)。步骤2和3(OAuth/API密钥检测、版本差异)不适用——Outcomes市场使用独立的凭证集。
  2. 确认
    okx-outcomes
    二进制文件可访问:
    bash
    okx outcomes status
    如果看到
    Error: okx-outcomes binary not found in PATH
    ,请先安装它(参见前提条件)。

Prerequisites

前提条件

bash
undefined
bash
undefined

1. Main OKX CLI (provides the
okx outcomes
wrapper command)

1. 主OKX CLI(提供
okx outcomes
包装命令)

npm install -g @okx_ai/okx-trade-cli
npm install -g @okx_ai/okx-trade-cli

2. Outcomes binary

2. Outcomes二进制文件

macOS / Linux:

macOS / Linux:

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)

环境变量(可选覆盖)

VarUsed forNotes
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 overrideDefaults to the region picked during setup
OKX_OUTCOMES_BIN
Binary path overrideUseful for local dev builds
Security: NEVER accept the signing private key in chat. The wallet is created by
okx outcomes setup
/
setup bind
and 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.
变量名用途说明
PREDICTIONS_AGENT_PRIVATE_KEY
链上写入操作(clob创建订单/撤单/ctf *)secp256k1十六进制字符串。通常由
okx outcomes setup
生成并存储在密钥环中——此环境变量仅覆盖它。切勿共享或打印。
PREDICTIONS_API_BASE
REST主机地址覆盖默认值为设置期间选择的区域
OKX_OUTCOMES_BIN
二进制文件路径覆盖对本地开发构建很有用
安全提示:切勿在聊天中接收签名私钥。钱包由
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
okx
CLI's OAuth / API-key flow — do NOT call
okx auth login
for outcomes; outcomes has its own
okx outcomes auth login
.
Operation classExample commandsCredential
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
)
Outcomes市场使用OKX OAuth登录进行已认证读取操作,使用EIP-712签名密钥进行链上写入操作。这些与主
okx
CLI的OAuth/API密钥流程无关——请勿为Outcomes调用
okx auth login
;Outcomes有自己的
okx outcomes auth login
命令。
操作类别示例命令凭证要求
公开数据
data events/event/market/ticker/candles
clob price/prices/midpoint/spread/book/books
已认证读取
account balance/order/orders/positions/trades
(已平仓使用
positions --status closed
)、
search
status
OAuth会话(
okx outcomes auth login
链上写入
clob create-order / market-order / cancel-oid / cancel-all / heartbeat
ctf split / merge / redeem
wallet show
签名密钥(密钥环中的
agent_private_key
,或
PREDICTIONS_AGENT_PRIVATE_KEY
环境变量)

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
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:
  • Agent runs directly:
    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).
  • 🙋 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
    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 outcomes
包装器会继承标准输入输出启动二进制文件,因此Agent捕获的标准输出会接收每个命令的输出。所有分步设置命令均可由Agent运行
  • Agent直接运行
    setup status
    setup region
    auth login --manual --json
    auth refresh
    auth status
    setup bind
    (转发绑定短链接;用户在手机或浏览器中打开)。
  • 🙋 用户仅需在浏览器/手机操作(无需执行命令):在浏览器中授权设备码URL;打开绑定短链接(手机点击→OKX应用,或粘贴到浏览器);如果链接无法打开,复制钱包地址并在OKX应用中手动绑定。
  • 🚫 切勿从Agent启动:完整交互式
    okx outcomes setup
    向导和
    okx outcomes shell
    REPL——两者均使用原始终端输入,若无TTY会挂起/报EOF错误。请改用上述分步子命令。
普通
okx outcomes auth login
(不带
--manual
)是针对真实终端用户的交互式/前台浏览器版本;Agent必须使用
--manual

Skill Routing

技能路由

  • YES/NO event-contract outcomes markets → this skill
  • OKX CEX Up/Down event contracts (different product) →
    okx-cex-trade
    (use
    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
undefined
bash
undefined

Health 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)

读取命令(无权限限制)

#CommandAuthDescription
1
okx outcomes data events [--status active] [--category <c>] [--limit <n>]
noneList outcome events
2
okx outcomes data event <eventId>
noneSingle event detail
3
okx outcomes data event-markets <eventId>
noneEvent + all its markets (includes YES/NO asset ids)
4
okx outcomes data market <marketId>
noneSingle market detail
5
okx outcomes data trending
noneTrending events
6
okx outcomes data ticker <assetId>
none24h ticker for one outcome asset
7
okx outcomes data candles <assetId> [--bar 1H] [--limit 100]
noneOHLCV candles
8
okx outcomes search <keyword>
OAuthKeyword search
9
okx outcomes clob price --asset <id> [--outcome yes|no]
noneTrimmed price (last/bid/ask/mid/spread)
10
okx outcomes clob prices <id1> <id2> ...
noneBatch 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...>
noneBid/ask spread
13
okx outcomes clob book --asset <id> [--sz <n>]
/
clob books <ids...>
noneMulti-level depth (default sz=10, max 400)
14
okx outcomes account balance
OAuthAccount balance
15
okx outcomes account order <orderId>
OAuthSingle order detail
16
okx outcomes account orders
OAuthOpen orders
17
okx outcomes account positions
OAuthOpen positions (look for status="Won" → redeem)
18
okx outcomes account positions --status closed
OAuthClosed positions + realized PnL
19
okx outcomes account trades
OAuthTrade history
20
okx outcomes wallet show
signingDerived wallet address
21
okx outcomes status
OAuthHealth check
22
okx outcomes auth status [--json]
noneOAuth session state
23
okx outcomes setup status [--json]
noneOnboarding progress (region/oauth/binding)
#命令认证要求描述
1
okx outcomes data events [--status active] [--category <c>] [--limit <n>]
列出结果事件
2
okx outcomes data event <eventId>
单个事件详情
3
okx outcomes data event-markets <eventId>
事件及其所有市场(包含YES/NO资产ID)
4
okx outcomes data market <marketId>
单个市场详情
5
okx outcomes data trending
热门事件
6
okx outcomes data ticker <assetId>
单个结果资产的24小时行情
7
okx outcomes data candles <assetId> [--bar 1H] [--limit 100]
OHLCV K线
8
okx outcomes search <keyword>
OAuth关键词搜索
9
okx outcomes clob price --asset <id> [--outcome yes|no]
简化价格(最新价/买价/卖价/中间价/点差)
10
okx outcomes clob prices <id1> <id2> ...
批量价格视图
11
okx outcomes clob midpoint --asset <id>
/
clob midpoints <ids...>
(买价+卖价)/2
12
okx outcomes clob spread --asset <id>
/
clob spreads <ids...>
买卖点差
13
okx outcomes clob book --asset <id> [--sz <n>]
/
clob books <ids...>
多层深度(默认sz=10,最大400)
14
okx outcomes account balance
OAuth账户余额
15
okx outcomes account order <orderId>
OAuth单个订单详情
16
okx outcomes account orders
OAuth未平仓订单
17
okx outcomes account positions
OAuth未平仓持仓(查找status="Won"→赎回)
18
okx outcomes account positions --status closed
OAuth已平仓持仓+已实现盈亏
19
okx outcomes account trades
OAuth交易历史
20
okx outcomes wallet show
签名密钥派生钱包地址
21
okx outcomes status
OAuth健康检查
22
okx outcomes auth status [--json]
OAuth会话状态
23
okx outcomes setup status [--json]
入门进度(区域/OAuth/绑定)

Setup / Auth commands

设置/认证命令

CommandAuthDescriptionAgent-runnable?
okx outcomes setup region <global|us>
noneSet region (step 1)✅ yes
okx outcomes auth login --manual --json
noneOAuth device-code (step 2): prints
{verificationUri,userCode,expiresIn}
and exits
✅ yes (relay URL+code to user)
okx outcomes auth refresh [--json]
noneVerify/refresh session after the user authorizes (writes session marker)✅ yes
okx outcomes setup bind [--keep] --json
signingBind 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>
noneInteractive/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
命令认证要求描述是否可由Agent运行?
okx outcomes setup region <global|us>
设置区域(步骤1)✅ 是
okx outcomes auth login --manual --json
OAuth设备码(步骤2):打印
{verificationUri,userCode,expiresIn}
并退出
✅ 是(将URL+验证码转发给用户)
okx outcomes auth refresh [--json]
用户授权后验证/刷新会话(写入会话标记)✅ 是
okx outcomes setup bind [--keep] --json
签名密钥绑定EOA钱包(步骤3):打印地址+短链接
deeplink
字段,
https://okx.com/ul/3OauBX?eoa=…&uid=…
);
--keep
复用现有钱包
✅ 是(用户打开短链接,或复制地址手动绑定)
okx outcomes auth login --site <global|us>
交互式/前台浏览器登录(针对真实终端用户)🚫 需要TTY
okx outcomes setup
/
okx outcomes shell
完整交互式向导/REPL🚫 需要TTY

Write commands (REQUIRE dry-run preview + user confirmation)

写入命令(需要试运行预览+用户确认)

#CommandRisk
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/trades
delegate to the corresponding
account *
commands. Prefer
account *
in skill output for clarity.
#命令风险等级
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]
25
okx outcomes clob market-order --asset <id> --side buy|sell --size [--tif ioc|fok] [--size-type base|quote]
高(立即成交)
26
okx outcomes clob cancel-oid --oid <id> --asset <id>
27
okx outcomes clob cancel-all
28
okx outcomes clob heartbeat
中(5分钟无操作自动撤单)
29
okx outcomes ctf split --market <id> --amount <xp>
高(锁定xp)
30
okx outcomes ctf merge --market <id> --amount <xp>
31
okx outcomes ctf redeem --market <id>
高(销毁全部盈利余额)
别名:
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
    status
    returns auth errors, the user isn't signed in — check
    okx outcomes auth status --json
    and guide them through "Setup & Onboarding" (
    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 (
    okx outcomes auth status --json
    ); otherwise route to "Setup & Onboarding".
  • 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
clob create-order
/
clob market-order
/
clob cancel-*
/
clob cancel-all
/
ctf *
command, render a dry-run summary first:
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
    okx outcomes data market <marketId>
    (look up
    marketId
    from the asset's parent market)
  • Asset + outcome — the numeric
    assetId
    from
    event-markets <eventId>
    plus which outcome (YES / NO) it represents
  • Notional
    price * size
    (xp)
  • Wallet
    okx outcomes wallet show --json
  • Available balance
    okx outcomes account balance --json
    → row where
    oddsType="spots"
    ,
    available
    field
Only after the user replies
confirm
do you run the real command. If anything else (including silence), abort.
在执行任何
clob create-order
/
clob market-order
/
clob cancel-*
/
clob cancel-all
/
ctf *
命令前,先生成试运行摘要
即将执行: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>
    的数字
    assetId
    及其代表的结果(YES / NO)
  • 名义价值 ——
    price * size
    (xp)
  • 钱包地址 ——
    okx outcomes wallet show --json
    的结果
  • 可用余额 ——
    okx outcomes account balance --json
    oddsType="spots"
    行的
    available
    字段
仅当用户回复
confirm
时才执行真实命令。任何其他回复(包括无回复)均终止操作。

Step 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:
  • references/setup-auth.md
    — setup status/region/bind, auth login/refresh/status, config & keyring storage, non-TTY rules
  • references/data-commands.md
    — events / event / market / trending / ticker / candles / search
  • references/account-commands.md
    — account balance / orders / positions / trades
  • references/clob-commands.md
    — clob price / order / orders / trades / create-order / cancel / cancel-all / heartbeat
  • references/ctf-commands.md
    — ctf split / merge / redeem
  • references/workflows.md
    — first-time setup / daily brief / event deep-dive / portfolio check / safe place-order / resolve-and-redeem
各命令组的详细参数表和示例:
  • references/setup-auth.md
    —— 设置状态/区域/绑定、认证登录/刷新/状态、配置与密钥环存储、非TTY规则
  • references/data-commands.md
    —— events / event / market / trending / ticker / candles / search
  • references/account-commands.md
    —— account balance / orders / positions / trades
  • references/clob-commands.md
    —— clob price / order / orders / trades / create-order / cancel / cancel-all / heartbeat
  • references/ctf-commands.md
    —— ctf split / merge / redeem
  • references/workflows.md
    —— 首次设置 / 每日简报 / 事件深度分析 / 投资组合检查 / 安全下单 / 结算与赎回

MCP Tool Reference

MCP工具参考

This 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.
当前版本中,本模块未暴露任何MCP工具。Agent通过Bash直接调用
okx outcomes <command>
。Outcomes团队未来可能会独立提供MCP服务器。

Edge Cases

边缘情况

  • 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
    .
  • Signing wallet missing: any
    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.
  • Asset id vs market id mix-up: the most common error class.
    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.
  • FOK rejected from snapshot:
    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
    .
  • 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) —
    okx outcomes status
    reports it.
  • okx-outcomes
    不在PATH中
    :包装器会打印安装提示并以127状态码退出。告知用户运行
    curl -fsSL https://raw.githubusercontent.com/okx/outcomes-cli/main/install.sh | sh
  • 签名钱包缺失:任何
    clob create-order
    /
    market-order
    /
    ctf *
    操作都会失败。运行
    okx outcomes setup bind --json
    (可由Agent运行),转发短链接
    deeplink
    字段,
    https://okx.com/ul/3OauBX?eoa=…&uid=…
    ),让用户打开链接(手机点击→OKX应用,或复制到浏览器);如果链接无法打开,让用户复制钱包地址并在OKX应用中手动绑定(Outcomes → Profile → Settings → API Bind Wallet)——切勿在聊天中索要密钥。
  • 资产ID与市场ID混淆:最常见的错误类型。
    clob price/book/create-order/market-order
    需要
    assetId
    ctf *
    account trades --market
    需要
    marketId
    。不确定时先运行
    event-markets <eventId>
    ——其输出会列出两者。
  • --tif gtd
    未搭配
    --expiry
    :客户端会拒绝。请搭配使用或默认使用
    gtc
  • --size-type quote
    用于非buy + ioc场景
    :客户端会拒绝(
    create-order
    )。提前告知用户“花费N点数”语法需要buy + IOC。
  • FOK因快照被拒绝:当可见深度不足时,
    clob market-order --tif fok
    会被客户端拒绝——不会发送签名消息。告知用户拒绝原因并建议减少
    --size
    或使用
    --tif ioc
  • 模式混淆:Outcomes市场没有演示/实时标志。站点在注册时选定。注意用户所处的部署环境(主网vs测试网)——
    okx outcomes status
    会报告。

Global Notes

全局说明

  • Always pass
    --json
    when piping into other tools or summarizing — the wrapper auto-appends
    --json
    if the user is in
    --json
    mode globally.
  • Unit of value: outcomes markets transact in points (xp), not USDC. All balances, prices (decimal in
    [0,1]
    ), notionals, and CTF amounts are xp.
  • Private key handling: NEVER echo
    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 is lowercase:
    --side buy
    /
    --side sell
    (write commands).
    account trades --side
    accepts
    BUY
    /
    SELL
    (uppercase) — the inconsistency is upstream, follow each command's signature.
  • Rate limits: authenticated endpoints follow OKX-style throttling. On
    429
    / rate-limit errors, back off and retry after the suggested wait.
  • The wrapper is transparent: every
    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).
  • 管道传输或汇总时始终传递
    --json
    ——如果用户全局处于
    --json
    模式,包装器会自动追加
    --json
  • 价值单位:Outcomes市场以**点数(xp)**交易,而非USDC。所有余额、价格(
    [0,1]
    区间的小数)、名义价值和CTF金额均为xp。
  • 私钥处理:切勿在聊天中输出
    PREDICTIONS_AGENT_PRIVATE_KEY
    (或任何以
    0x
    开头的64位十六进制字符串)。如需引用,掩码为
    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
    产物的本地开发很有用)。