okx-dex-strategy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOnchain OS DEX Strategy (Phase 1)
Onchain OS DEX 策略(第一阶段)
4 P0 subcommands that wrap the Agentic Wallet limit-order surface — , , , . SA activation (Trader Mode upgrade / re-upgrade) is performed transparently by the CLI when the BE returns ; the skill does not need to expose that detail.
create-limitcancellistresumeUPGRADE_REQUIRED4个封装Agentic Wallet限价单功能的P0子命令——、、、。当后端(BE)返回时,CLI会自动执行SA激活(交易员模式升级/重新升级);本技能无需向用户暴露此细节。
create-limitcancellistresumeUPGRADE_REQUIREDPre-flight Checks
前置检查
Read. If that file does not exist, fall back to../okx-agentic-wallet/_shared/preflight.md. Strategy endpoints require an authenticated Agentic Wallet session — confirm login before running any subcommand._shared/preflight.md
阅读。若该文件不存在,则回退至../okx-agentic-wallet/_shared/preflight.md。策略端点需要已认证的Agentic Wallet会话——运行任何子命令前请确认已登录。_shared/preflight.md
Display labels & output language (single source of truth)
显示标签与输出语言(唯一可信来源)
This section is the canonical rule for user-facing strings. Every other section in this skill defers to it.
Canonical Display labels — the only strings the agent may surface to the user. The CLI returns these directly () for ; for the agent looks them up from the § and § tables below.
statusLabelstatusstrategyTypestrategyTypestatus| Surface | Canonical EN Display labels |
|---|---|
| |
| |
Translation rule — match the user's conversation language. Display labels above are canonical English. When the user converses in another language, the agent translates the label at output time to match the conversation language.
Never (these rules apply everywhere in this skill):
- mix two languages in one label (pick one — never render the English label and a translation side by side),
- expose the underlying enum name (,
BUY_DIP,CHASE_HIGH, …) to the user,COMPLETED - expose the underlying CLI flag value (,
buy_dip,chase_high,completed, …) to the user,cancelled - pass through the CLI's raw verbatim when the user is conversing in a non-English language — translate it.
statusLabel
Notes:
- CHASE_HIGH renders as in English (not "Chase High").
Buy Above - SPEEDING_UP (-4) was removed 2026-05-08 — not a valid filter or display value.
本节是用户可见字符串的标准规则,本技能的其他所有章节均需遵循此规则。
标准显示标签——Agent可向用户展示的唯一字符串。CLI会直接返回对应的;对于,Agent需根据下方的§和§表进行查找。
statusstatusLabelstrategyTypestrategyTypestatus| 展示场景 | 标准英文显示标签 |
|---|---|
| |
| |
翻译规则——匹配用户的对话语言。上述显示标签为标准英文,当用户使用其他语言对话时,Agent需在输出时将标签翻译为对应语言。
绝对禁止(本技能所有场景均适用):
- 在一个标签中混合两种语言(二选一——绝不能同时显示英文标签和翻译版本),
- 向用户暴露底层枚举名称(如、
BUY_DIP、CHASE_HIGH等),COMPLETED - 向用户暴露底层CLI参数值(如、
buy_dip、chase_high、completed等),cancelled - 当用户使用非英文对话时,直接透传CLI的原始——必须进行翻译。
statusLabel
注意事项:
- CHASE_HIGH在英文中显示为****(而非"Chase High")。
Buy Above - SPEEDING_UP(-4)已于2026-05-08移除——不再作为有效筛选或显示值。
Boundary vs okx-dex-swap
okx-dex-swap与okx-dex-swap
的边界区分
okx-dex-swap| User intent | Skill |
|---|---|
| "Swap X for Y now" / "Buy 0.5 ETH with USDC" | |
| "Buy ETH if it dips to $2000" / "Sell when ETH hits $5000" / "Take profit at X" / "Stop loss at Y" | this skill (price-triggered limit order) |
| "Cancel my pending order" | this skill |
| "What limit orders do I have?" | this skill |
If the venue is named explicitly (Uniswap, PancakeSwap, Raydium, Curve, ...) → re-route to . This skill is for OKX-aggregated limit orders only.
okx-dapp-discovery| 用户意图 | 对应技能 |
|---|---|
| "立即将X兑换为Y" / "用USDC买入0.5 ETH" | |
| "若ETH跌至2000美元则买入" / "当ETH涨到5000美元时卖出" / "在X价位止盈" / "在Y价位止损" | 本技能(价格触发的限价单) |
| "取消我的挂单" | 本技能 |
| "查看我的限价单" | 本技能 |
若用户明确指定了交易场所(Uniswap、PancakeSwap、Raydium、Curve等)→ 路由至。本技能仅适用于OKX聚合限价单。
okx-dapp-discoveryCommand Index
命令索引
1. onchainos strategy create-limit
onchainos strategy create-limit1. onchainos strategy create-limit
onchainos strategy create-limitPlace a single price-triggered limit order.
onchainos strategy create-limit \
--chain-id <id|alias> \
--from-token <address> \
--to-token <address> \
--amount <decimal-string> \
--direction <buy|sell> \
--trigger-price <usd> \
[--current-price <usd>] \
[--slippage <value>] \
[--mev-protection <on|off|default>] \
[--expires-in <secs>]| Flag | Required | Notes |
|---|---|---|
| Y | Chain id or alias: |
| Y | Sell-side token contract address |
| Y | Buy-side token contract address |
| Y | Amount of |
| Y | |
| Y | USD trigger price. Required for strategy type derivation. |
| N | Current USD price of the comparison token (to-token for |
| N | Slippage tolerance in percent. Default |
| N | Tri-state value: |
| N | Order TTL in seconds. Default 604800 (7 days) — see §Default order expiry. |
Output (JSON, always — the CLI has no human-format mode):
json
{
"ok": true,
"data": {
"orderId": "<id>",
"status": <int>,
"statusLabel": "<label>",
"estimatedWaitTime": <int|null>,
"eventCursor": "<string|null>"
}
}Solana orders return — the order is queryable immediately; for all other chains the agent follows §Async wait pattern (fixed 3-second sleep before re-querying).
estimatedWaitTime=0下达单个价格触发的限价单。
onchainos strategy create-limit \\
--chain-id <id|alias> \\
--from-token <address> \\
--to-token <address> \\
--amount <decimal-string> \\
--direction <buy|sell> \\
--trigger-price <usd> \\
[--current-price <usd>] \\
[--slippage <value>] \\
[--mev-protection <on|off|default>] \\
[--expires-in <secs>]| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是 | 链ID或别名: |
| 是 | 卖出方代币合约地址 |
| 是 | 买入方代币合约地址 |
| 是 | 卖出的 |
| 是 | |
| 是 | USD计价的触发价格。是推导策略类型的必填项。 |
| 否 | 对比代币的当前USD价格( |
| 否 | 滑点容忍度(百分比)。默认值为 |
| 否 | 三态值: |
| 否 | 订单有效期(秒)。默认值为604800(7天)——详见§默认订单有效期。 |
输出(始终为JSON格式——CLI无人类可读格式):
json
{
"ok": true,
"data": {
"orderId": "<id>",
"status": <int>,
"statusLabel": "<label>",
"estimatedWaitTime": <int|null>,
"eventCursor": "<string|null>"
}
}Solana订单返回——订单可立即查询;对于其他链,Agent需遵循§异步等待模式(固定等待3秒后重新查询)。
estimatedWaitTime=0Default order expiry
默认订单有效期
Phase 1 BE default = 7 days ( seconds). This is the single source of truth — everywhere else in this skill that mentions "7 days" (the §Two-step confirmation expiry note, the §list "Expire after" column note, etc.) derives from here. If BE changes the default, update this section and propagate to the other mentions.
604800Slippage interpretation reminder (no echo from CLI):input is in percent units —--slippage= 0.05% (wire0.05), NOT 5%. To set 5% slippage, pass"0.0005". The skill / agent should convey this to the user at input time; the CLI itself does not echo a confirmation line.--slippage 5
第一阶段后端默认值为7天(秒)。此为唯一可信来源——本技能中所有提及"7天"的内容(如§两步确认流程的有效期说明、§list命令的"到期时间"列说明等)均由此推导。若后端修改默认值,需更新本节并同步至其他提及处。
604800滑点解读提醒(CLI无回显):输入为百分比单位——--slippage= 0.05%(传输格式为0.05),而非5%。若要设置5%滑点,需传入"0.0005"。技能/Agent应在用户输入时向其说明此规则;CLI本身不会回显确认信息。--slippage 5
Supported chains (Phase 1, locked)
支持的链(第一阶段,固定)
Strategy orders are only supported on these 6 chains. Any other chain MUST be rejected upfront by the agent — do not call and do not even open the Step 1 confirmation.
create-limit| chainIndex | Name | |
|---|---|---|
| 1 | Ethereum | |
| 56 | BSC | |
| 196 | X Layer | |
| 501 | Solana | |
| 8453 | Base | |
| 42161 | Arbitrum | |
Pre-flight rule (agent): when the user mentions a chain, resolve it to its chainIndex and check this list. If the chain is not in the table (e.g. Polygon , Optimism , Avalanche , Linea , Sui , Tron , ...), respond directly with:
137104311459144784195Strategy orders are only supported on Ethereum / BSC / X Layer / Solana / Base / Arbitrum right now.is not supported — pick one of these to continue.<requested chain>
Do NOT proceed to Step 1 confirmation. Do NOT call the CLI. The CLI also defends against this (validates against the same 6-chain whitelist before BE), but the agent catching it earlier saves a round trip and gives a clearer message tied to the user's exact phrasing.
策略订单仅支持以下6条链。Agent需提前拒绝任何其他链的请求——不得调用,甚至不得进入第1步确认流程。
create-limit| chainIndex | 名称 | |
|---|---|---|
| 1 | Ethereum | |
| 56 | BSC | |
| 196 | X Layer | |
| 501 | Solana | |
| 8453 | Base | |
| 42161 | Arbitrum | |
前置规则(Agent):当用户提及某条链时,将其解析为chainIndex并核对此列表。若该链不在列表中(例如Polygon 、Optimism 、Avalanche 、Linea 、Sui 、Tron 等),直接回复:
137104311459144784195当前仅支持在Ethereum / BSC / X Layer / Solana / Base / Arbitrum上使用策略订单。<请求的链>暂不支持——请从上述链中选择以继续操作。
不得进入第1步确认流程,不得调用CLI。CLI也会对此进行防御(调用后端前验证6链白名单),但Agent提前拦截可避免一次请求往返,并给出与用户表述更契合的清晰提示。
strategyType
enum (BaseOrderStrategyTypeEnum, locked)
strategyTypestrategyType
枚举(BaseOrderStrategyTypeEnum,固定)
strategyType| Int value | Enum name | Default direction | CLI | Display label | Semantics |
|---|---|---|---|---|---|
| 2 | BUY_DIP | BUY (0) | | Buy Dip | Buy when market price falls to trigger |
| 3 | TAKE_PROFIT | SELL (1) | | Take Profit | Sell when market price rises to trigger |
| 4 | STOP_LOSS | SELL (1) | | Stop Loss | Sell when market price falls to trigger |
| 5 | CHASE_HIGH | BUY (0) | | Buy Above | Buy when market price rises above trigger |
The Display label column is the only user-facing string — see §Display labels & output language for the cross-cutting rule. The agent never sees, computes, or passes the integer; the CLI maps everything internally.
strategyType| 整数值 | 枚举名称 | 默认方向 | CLI | 显示标签 | 语义 |
|---|---|---|---|---|---|
| 2 | BUY_DIP | BUY (0) | | 抄底 | 当市场价格跌至触发价时买入 |
| 3 | TAKE_PROFIT | SELL (1) | | 止盈 | 当市场价格涨至触发价时卖出 |
| 4 | STOP_LOSS | SELL (1) | | 止损 | 当市场价格跌至触发价时卖出 |
| 5 | CHASE_HIGH | BUY (0) | | 追高买入 | 当市场价格涨至触发价以上时买入 |
显示标签列是唯一对用户可见的字符串——请遵循§显示标签与输出语言的通用规则。Agent无需查看、计算或传递整数值;CLI会在内部完成所有映射。
strategyTypeStrategy type derivation (CLI-owned; agent uses table only for display)
策略类型推导(CLI负责;Agent仅用于显示)
strategyType(--direction, --trigger-price, current market price)--type| Direction | trigger vs current | Inferred strategyType | Display label |
|---|---|---|---|
| buy | trigger < current | BUY_DIP (2) | Buy Dip |
| buy | trigger ≥ current | CHASE_HIGH (5) | Buy Above |
| sell | trigger > current | TAKE_PROFIT(3) | Take Profit |
| sell | trigger ≤ current | STOP_LOSS (4) | Stop Loss |
Equality is folded into the "aggressive" side (CHASE_HIGH / STOP_LOSS) — same rule the CLI enforces.
Agent flow:
- Parse direction (buy / sell) from user intent ("buy" / "ape in" / "snap up" → buy; "sell" / "take profit" / "stop loss" / "exit" → sell). Passed verbatim as .
--direction <buy|sell> - Fetch current price — call , read
onchainos market price --chain <chain> --address <token>. For BUY direction query the to-token's current price; for SELL direction query the from-token's current price. The agent needs this for (a) Step 0 USD-value pre-flight, (b) the Step 1 confirmation page "Trigger Price vs current", and (c) computing the Display label per the table above.data[0].price - Pass to the CLI so it does not re-fetch. (If the agent omits it, the CLI fetches the same value itself — correct but one extra round-trip.)
--current-price <usd>
strategyType(--direction, --trigger-price, 当前市场价格)--type| 方向 | 触发价与当前价的关系 | 推导的strategyType | 显示标签 |
|---|---|---|---|
| buy | 触发价 < 当前价 | BUY_DIP (2) | 抄底 |
| buy | 触发价 ≥ 当前价 | CHASE_HIGH (5) | 追高买入 |
| sell | 触发价 > 当前价 | TAKE_PROFIT(3) | 止盈 |
| sell | 触发价 ≤ 当前价 | STOP_LOSS (4) | 止损 |
相等情况归入"激进"侧(CHASE_HIGH / STOP_LOSS)——与CLI执行的规则一致。
Agent流程:
- 解析方向(buy / sell):从用户意图中提取("买入" / "进场" / "抢购" → buy;"卖出" / "止盈" / "止损" / "离场" → sell)。直接传递为。
--direction <buy|sell> - 获取当前价格——调用,读取
onchainos market price --chain <chain> --address <token>。BUY方向查询to-token的当前价格;SELL方向查询from-token的当前价格。Agent需此价格用于:(a) 第0步USD价值前置检查,(b) 第1步确认页的"触发价 vs 当前价"展示,(c) 根据上述表格计算显示标签。data[0].price - 向CLI传递:避免CLI重复获取。(若Agent省略此参数,CLI会自行获取相同值——结果正确但多一次请求往返。)
--current-price <usd>
Two-step confirmation flow (Agent must follow)
两步确认流程(Agent必须遵循)
create-limitStep 0 — Minimum order value pre-flight (must run before Step 1):
BE enforces a minimum order value of $1 USD (returns error otherwise). To avoid wasting a round-trip and a confirmation page on an amount that BE will reject, the agent MUST verify the from-side USD value first.
100010 ORDER_AMOUNT_TOO_SMALL- Fetch the from-token price (USD):
- If from-token is a well-known stablecoin (USDT / USDC / USDG / USDe / DAI / FDUSD / ...): assume without an HTTP call.
from_price ≈ 1.0 - Otherwise: call , read
onchainos market price --chain <chain> --address <from_token>asdata[0].price.from_price
- If from-token is a well-known stablecoin (USDT / USDC / USDG / USDe / DAI / FDUSD / ...): assume
- Compute USD value: .
usd_value = from_amount × from_price - If :
usd_value < 1.0-
Computerounded up to a reasonable display precision for the token (e.g. whole units when
min_from_amount = ceil(1.0 ÷ from_price); 2-4 significant digits otherwise).from_price ≥ 0.1 -
Surface exactly this single canonical line to the user, with no extra prose — no USD-value math, no $1 threshold mention, no echo of the user's original amount, no follow-up sentence, no apology:
Minimum order amount: <min_from_amount> <from_symbol>Translate the prefix at output time per §Display labels & output language (e.g. for a Chinese user the agent renders the same fact in Chinese). The structure stays single-line:.<localised prefix> <min_from_amount> <from_symbol> -
STOP. Do NOT render Step 1. Do NOT call the CLI. Wait for the user to provide a larger, then re-run Step 0 from the top.
--amount
-
- If : carry
usd_value ≥ 1.0forward (Step 1's "Value" column reuses it; no need to re-fetch) and proceed to Step 1.from_price
Example (user wants to spend 1 OKB on a chain where OKB ≈ $0.10):
- ,
from_price = 0.10→ failusd_value = 1 × 0.10 = 0.10 < 1.0 min_from_amount = ceil(1.0 / 0.10) = 10- Output:
Minimum order amount: 10 OKB - Stop. No Step 1, no extra prose.
Step 1 — Show the order summary for the user to confirm. Five top-level categories with sub-items; the agent may freely organise prose at runtime, but no category may be dropped:
| # | Category | Sub-items | Source |
|---|---|---|---|
| 1 | Chain | — | Human-readable chain name resolved from |
| 2 | Order Type | Display label per the § | Derived per "Strategy type derivation" above |
| 3 | From token | Symbol (e.g. | Symbol from token metadata; Amount is raw |
| 4 | To token | Symbol (e.g. | Symbol/Trigger Price direct; Estimated Amount and Value computed by the agent — see formulas below |
| 5 | Slippage | Either | See Slippage display rules below |
Estimated Amount / Value formulas:
- Buy direction (BUY_DIP / CHASE_HIGH):
- =
Estimated Amount÷from_amount(in units of to-token)trigger_price - =
Value×from_amount(if from is a stablecoin, ≈from_token_USD_price)from_amount
- Sell direction (TAKE_PROFIT / STOP_LOSS):
- =
Estimated Amount×from_amount(in units of to-token, usually a stablecoin)trigger_price - =
Value×from_amount(if to is a stablecoin, equals Estimated Amount)trigger_price
Slippage display rules:
- User did NOT mention slippage in the conversation → display , and omit
Slippage: Default 15%on the CLI call (the CLI default is 15).--slippage - User explicitly said "slippage X%" / "use X% slippage" / similar → display , and pass
Slippage: User-specified X%on the CLI call.--slippage X
Structural example (display labels come from the § / § tables; see §Display labels & output language for the cross-cutting rule):
strategyTypestatus1. Chain: Arbitrum
2. Order Type: Buy Dip
3. From: USDC 10
4. To:
- Symbol: ARB
- Trigger Price: $0.10
- Estimated Amount: 100 ARB
- Value: $10
5. Slippage: 15% (default)
If the trigger condition is not met within 7 days, this order auto-expires.
Reply confirm / change / cancel.Expiry note (mandatory): After the 5 categories and before the reply prompt, the agent must surface that the limit order auto-expires 7 days after creation if the trigger never fires. Default phrasing:
If the trigger condition is not met within 7 days, this order auto-expires.Step 2 — Handle the user's reply:
- User says "confirm" / "yes" / "submit" → call with the
onchainos strategy create-limit ...derived in Step 1.--type - User says "change amount = 5" / "set trigger to 0.08" / similar → update the corresponding field and re-render Step 1 for another confirmation.
- User says "cancel" / "abort" → do NOT call the CLI; acknowledge that the order was discarded.
Hard constraints:
- Never call
until the user has explicitly confirmed.strategy create-limit /Estimated Amountare agent-side estimates derived fromValue, not BE quotes. The realised fill amount is decided at BE execution time by slippage and aggregator routing; the agent must not present these estimates as "actual fill amounts".trigger_price is a USD price. The agent must make this clear to the user to avoid confusion with "exchange rate = X from-token per 1 to-token".--trigger-price- Never render Step 1 when Step 0's USD-value check fails. Output the single-line minimum-amount warning instead and stop — the user must restart with a larger
.--amount
create-limit第0步——最小订单价值前置检查(必须在第1步前执行):
后端强制执行最小订单价值为1美元(否则返回错误)。为避免在后端会拒绝的订单金额上浪费请求往返和确认页,Agent必须先验证卖出方的USD价值。
100010 ORDER_AMOUNT_TOO_SMALL- 获取from-token的USD价格:
- 若from-token为知名稳定币(USDT / USDC / USDG / USDe / DAI / FDUSD等):无需HTTP请求,直接假设。
from_price ≈ 1.0 - 其他情况:调用,读取
onchainos market price --chain <chain> --address <from_token>作为data[0].price。from_price
- 若from-token为知名稳定币(USDT / USDC / USDG / USDe / DAI / FDUSD等):无需HTTP请求,直接假设
- 计算USD价值: 。
usd_value = from_amount × from_price - 若:
usd_value < 1.0-
计算,并按代币的合理显示精度向上取整(例如当
min_from_amount = ceil(1.0 ÷ from_price)时取整数;否则取2-4位有效数字)。from_price ≥ 0.1 -
向用户展示唯一标准语句,不得添加额外内容——无需说明USD价值计算、1美元阈值、回显用户原金额、后续语句或致歉:
最小订单金额:<min_from_amount> <from_symbol>根据§显示标签与输出语言的规则,在输出时翻译前缀(例如对中文用户,Agent需用中文展示相同内容)。格式保持单行:。<本地化前缀> <min_from_amount> <from_symbol> -
停止操作。不得进入第1步,不得调用CLI。 等待用户提供更大的,然后重新执行第0步。
--amount
-
- 若: 保留
usd_value ≥ 1.0(第1步的"价值"列会复用此值,无需重新获取),进入第1步。from_price
示例(用户想用1 OKB下单,该链上OKB≈0.10美元):
- ,
from_price = 0.10→ 检查不通过usd_value = 1 × 0.10 = 0.10 < 1.0 min_from_amount = ceil(1.0 / 0.10) = 10- 输出:
最小订单金额:10 OKB - 停止操作。不得进入第1步,不得添加额外内容。
第1步——向用户展示订单摘要以确认。 包含5个顶级分类及子项;Agent可在运行时自由组织表述,但不得遗漏任何分类:
| # | 分类 | 子项 | 来源 |
|---|---|---|---|
| 1 | 链 | — | 从 |
| 2 | 订单类型 | 根据§ | 根据上述"策略类型推导"规则得出 |
| 3 | 卖出代币 | 符号(例如 | 代币元数据中的符号;数量为原始 |
| 4 | 买入代币 | 符号(例如 | 符号/触发价直接获取;预估数量和价值由Agent计算——见下方公式 |
| 5 | 滑点 | 若用户未提及滑点则显示 | 见滑点显示规则 |
预估数量/价值公式:
- 买入方向(抄底 / 追高买入):
- =
预估数量÷from_amount(买入代币单位)trigger_price - =
价值×from_amount(若为稳定币,≈from_token_USD_price)from_amount
- 卖出方向(止盈 / 止损):
- =
预估数量×from_amount(买入代币单位,通常为稳定币)trigger_price - =
价值×from_amount(若为稳定币,等于预估数量)trigger_price
滑点显示规则:
- 用户对话中未提及滑点 → 显示,且CLI调用时省略
滑点:默认15%(CLI默认值为15)。--slippage - 用户明确表示"滑点X%" / "使用X%滑点"等 → 显示,且CLI调用时传递
滑点:用户指定X%。--slippage X
结构示例(显示标签来自§ / §表;请遵循§显示标签与输出语言的通用规则):
strategyTypestatus1. 链:Arbitrum
2. 订单类型:抄底
3. 卖出:USDC 10
4. 买入:
- 符号:ARB
- 触发价:$0.10
- 预估数量:100 ARB
- 价值:$10
5. 滑点:15%(默认)
若7天内未满足触发条件,此订单将自动过期。
请回复 confirm / change / cancel。有效期说明(必填):在5个分类之后、回复提示之前,Agent必须告知用户:若触发条件始终未满足,限价单将在创建7天后自动过期。默认表述:
若7天内未满足触发条件,此订单将自动过期。第2步——处理用户回复:
- 用户回复"confirm" / "yes" / "submit" → 调用,传入第1步推导的
onchainos strategy create-limit ...。--type - 用户回复"change amount = 5" / "set trigger to 0.08"等 → 更新对应字段并重新渲染第1步以再次确认。
- 用户回复"cancel" / "abort" → 不得调用CLI;告知用户订单已取消。
硬性约束:
- 必须在用户明确确认后才可调用
。strategy create-limit /预估数量是Agent基于价值的估算值,并非后端报价。实际成交数量由后端执行时的滑点和聚合器路由决定;Agent不得将这些估算值表述为"实际成交数量"。trigger_price 是USD价格。Agent必须向用户明确说明,避免与"汇率=X卖出代币/1买入代币"混淆。--trigger-price- 当第0步的USD价值检查不通过时,不得渲染第1步。 仅输出单行最小金额提示并停止操作——用户必须重新提供更大的
。--amount
2. onchainos strategy cancel
onchainos strategy cancel2. onchainos strategy cancel
onchainos strategy cancelCancel a single, batch, or all active orders. Pass exactly one of the three flags:
onchainos strategy cancel --order-id <id>
onchainos strategy cancel --order-ids id1,id2,...
onchainos strategy cancel --allOutput (JSON): . is the count BE accepted, not the count that reached terminal state — re-query with after the wait.
{ok:true,data:{updateNum:N,estimatedWaitTime:null|n}}updateNumlist取消单个、批量或所有活跃订单。需传递以下三个参数中的任意一个:
onchainos strategy cancel --order-id <id>
onchainos strategy cancel --order-ids id1,id2,...
onchainos strategy cancel --all输出(JSON): 。是后端接受的订单数量,并非已进入终态的数量——等待后需用重新查询。
{ok:true,data:{updateNum:N,estimatedWaitTime:null|n}}updateNumlist3. onchainos strategy list
onchainos strategy list3. onchainos strategy list
onchainos strategy listonchainos strategy list \
[--order-id <id>] \
[--status active,suspended,...] \
[--chain-id 1,501] \
[--token <address>] \
[--limit <int>] \
[--cursor <string>] \
[--strategy-mode 7]Two modes:
- Single order: pass → GET
--order-id <id>(returns full order shape).openOrderDetail - Page query: omit → POST
--order-id. The active wallet's addresses are auto-supplied; passgetOpenOrder(max 100, default 100) and--limitfrom the previous response's--cursorfor pagination.nextCursor
Flag accepts-CSV inconsistency — and accept comma-separated lists (BE fields are / , plural). accepts a single address only — BE schema 2026-05-09 replaced the prior with a singular field. For multi-token queries, the agent calls once per token and merges the results.
--status--chain-idorderStatusListchainIdList--tokentokenAddressList: List<String>tokenAddress: Stringlistonchainos strategy list \\
[--order-id <id>] \\
[--status active,suspended,...] \\
[--chain-id 1,501] \\
[--token <address>] \\
[--limit <int>] \\
[--cursor <string>] \\
[--strategy-mode 7]两种模式:
- 单个订单:传递→ 调用
--order-id <id>(返回完整订单结构)。openOrderDetail - 分页查询:省略→ 调用
--order-id。CLI会自动传入当前钱包的地址;可传递getOpenOrder(最大值100,默认100)和上一次响应中的--limit作为nextCursor以实现分页。--cursor
参数CSV兼容性差异——和接受逗号分隔的列表(后端字段为 / ,复数形式)。仅接受单个地址——2026-05-09更新的后端架构将原有的替换为单数字段。若需查询多个代币,Agent需为每个代币调用一次并合并结果。
--status--chain-idorderStatusListchainIdList--tokentokenAddressList: List<String>tokenAddress: StringlistgetOpenOrder
request body fields (locked)
getOpenOrdergetOpenOrder
请求体字段(固定)
getOpenOrder| field | type | required | meaning |
|---|---|---|---|
| String | Y | Account ID, used for JWT auth. CLI auto-injects from the current session; the agent does not pass this |
| List<String> | Y | Wallet address list. CLI auto-injects from the current wallet context (EVM + SOL) |
| List<String> | N | Chain ID filter; omit to query all chains. Mapped from |
| List<Integer> | N | Status filter (enum below). CLI defaults to the 5 non-terminal codes when |
| List<Integer> | N | Order-type filter (BE §3.3 enum); not used in Phase 1 |
| List<String> | N | Exact-match filter by order ID; no dedicated flag in Phase 1 — use |
| String | N | Filter by a single token address. Mapped from |
| Integer | N | Page size; BE default 100, max 100. Agent must pass |
| String | N | Pagination cursor (Base64). Omit on first page; pass the previous response's |
| 字段 | 类型 | 是否必填 | 含义 |
|---|---|---|---|
| String | 是 | 账户ID,用于JWT认证。CLI会从当前会话自动注入;Agent无需传递 |
| List<String> | 是 | 钱包地址列表。CLI会从当前钱包上下文自动注入(EVM + SOL) |
| List<String> | 否 | 链ID筛选;省略则查询所有链。由 |
| List<Integer> | 否 | 状态筛选(见下方枚举)。当省略 |
| List<Integer> | 否 | 订单类型筛选(后端§3.3枚举);第一阶段未使用 |
| List<String> | 否 | 按订单ID精确匹配筛选;第一阶段无专用参数——使用 |
| String | 否 | 按单个代币地址筛选。由 |
| Integer | 否 | 分页大小;后端默认100,最大值100。Agent在默认列表渲染时必须传递 |
| String | 否 | 分页游标(Base64格式)。首次查询省略;后续查询传递上一次响应中的 |
status
enum (TeeSaOpenOrderStatusEnum, locked)
statusstatus
枚举(TeeSaOpenOrderStatusEnum,固定)
statusFull 10-state mapping — agent reads integer and looks up the display label here:
data.list[].status| Int value | Enum name | CLI | Display label | Terminal? |
|---|---|---|---|---|
| -7 | EXPIRED | | Expired | Yes |
| -3 | CANCELLING | | Cancelling | No (transient) |
| -2 | CANCELLED | | Cancelled | Yes |
| -1 | FAILED | | Failed | Yes |
| 0 | TRADING | | Trading | No |
| 1 | COMPLETED | | Completed | Yes |
| 2 | CREATING | | Creating | No |
| 3 | ACTIVE | | Active | No |
| 4 | SUSPENDED | | Suspended | No |
SPEEDING_UP (-4) was removed 2026-05-08 — not surfaced and not a valid filter option. The Display label column is the only user-facing string; see §Display labels & output language. CLI'salready returns the display label, so just translate it per conversation language.statusLabel
Non-terminal set (5): = CANCELLING / TRADING / CREATING / ACTIVE / SUSPENDED
Terminal set (4): = EXPIRED / CANCELLED / FAILED / COMPLETED
{-3, 0, 2, 3, 4}{-7, -2, -1, 1}Default status filter (when is omitted): the CLI puts into the request body — the 5 non-terminal states (CANCELLING / TRADING / CREATING / ACTIVE / SUSPENDED) — and BE applies the filter server-side, returning only matching orders. Terminal orders (Cancelled / Completed / Failed / Expired) are excluded by default. Rationale: when a user asks "show my orders" they almost always mean live ones; surfacing historical terminal records pollutes the answer.
--statusorderStatusList=[-3, 0, 2, 3, 4]To see terminal orders the agent must pass explicitly:
--status| User intent | |
|---|---|
| "show my completed orders" | |
| "show my cancelled orders" | |
| "show failed orders" | |
| "show expired orders" | |
| "show all orders including terminal" | |
| "show my live orders" / no qualifier | (omit |
--status4activesuspendedprocessingcreatingcancellingcancelledcompletedfailedexpired完整的10状态映射——Agent读取整数值并在此查找显示标签:
data.list[].status| 整数值 | 枚举名称 | CLI | 显示标签 | 是否终态 |
|---|---|---|---|---|
| -7 | EXPIRED | | 已过期 | 是 |
| -3 | CANCELLING | | 取消中 | 否(临时状态) |
| -2 | CANCELLED | | 已取消 | 是 |
| -1 | FAILED | | 已失败 | 是 |
| 0 | TRADING | | 交易中 | 否 |
| 1 | COMPLETED | | 已完成 | 是 |
| 2 | CREATING | | 创建中 | 否 |
| 3 | ACTIVE | | 活跃中 | 否 |
| 4 | SUSPENDED | | 已暂停 | 否 |
SPEEDING_UP(-4)已于2026-05-08移除——不再展示,也不作为有效筛选选项。显示标签列是唯一对用户可见的字符串;请遵循§显示标签与输出语言的规则。CLI的已返回显示标签,只需根据对话语言翻译即可。statusLabel
非终态集合(5种): = 取消中 / 交易中 / 创建中 / 活跃中 / 已暂停
终态集合(4种): = 已过期 / 已取消 / 已失败 / 已完成
{-3, 0, 2, 3, 4}{-7, -2, -1, 1}默认状态筛选(省略时):CLI会在请求体中传入——即5种非终态(取消中 / 交易中 / 创建中 / 活跃中 / 已暂停)——后端会在服务器端应用此筛选,仅返回匹配的订单。终态订单(已取消 / 已完成 / 已失败 / 已过期)默认排除。设计理由:当用户询问"查看我的订单"时,几乎总是指活跃订单;展示历史终态记录会干扰回答。
--statusorderStatusList=[-3, 0, 2, 3, 4]若要查看终态订单,Agent必须显式传递:
--status| 用户意图 | 需传递的 |
|---|---|
| "查看我的已完成订单" | |
| "查看我的已取消订单" | |
| "查看已失败订单" | |
| "查看已过期订单" | |
| "查看所有订单(包括终态)" | |
| "查看我的活跃订单" / 无限定词 | (省略 |
--status4activesuspendedprocessingcreatingcancellingcancelledcompletedfailedexpiredAgent rendering rules (when the user asks for orders without naming a specific status)
Agent渲染规则(用户未指定具体状态时)
User prompts that match this rule include: "show my strategy orders" / "list orders" / "show my limit orders" / "what orders do I have" — i.e. any general "show me my orders" intent without a status qualifier.
Steps the agent must follow:
-
Run(no
onchainos strategy list --limit 10) — the CLI puts--status(non-terminal set) into the request body; BE applies the filter server-side and returns only matching orders. Always passorderStatusList=[-3, 0, 2, 3, 4]for general "show my orders" queries; full pagination is opt-in via "next page" follow-up.--limit 10 -
Render the responseas a Markdown table with exactly these 8 columns (locked):
data.listOrder id Order Status Order Type Estimated Amount To Token addr Value Trigger price Expire after Per-row mapping (order matters, no extra columns):Column Source Notes Order id data.list[i].orderId— Order Status (Display label per the §data.list[i].statusLabeltable)statusTranslate per §Display labels & output language Order Type Display label per the § table, derived fromstrategyTypeinteger (data.list[i].strategyType/2 → Buy Dip/3 → Take Profit/4 → Stop Loss)5 → Buy AboveTranslate per §Display labels & output language Estimated Amount +data.list[i].toToken.tokenAmount+data.list[i].toToken.tokenSymbole.g. 0.2 SOLTo Token addr , truncated to first-6 + last-4data.list[i].toToken.tokenContractAddressEVM: (0x1234...cdef+ 4 chars +0x+ 4 chars); Solana base58: first 6 +...+ last 4...Value , formatted asdata.list[i].toToken.tokenUsd<n> USDe.g. (round or 2-decimal, follow BE precision)16 USDTrigger price , prefixed withdata.list[i].triggerInfo.triggerPrice$e.g. ; if empty (trigger-rate path, not used in Phase 1) display$80data.list[i].triggerInfo.triggerRateExpire after (13-digit ms UTC), converted to the user's current timezone, formatteddata.list[i].expireTimeMM/DD/YYYY HH:MM:SSe.g. (semantically = createTime + 7 days by default)05/15/2026 17:50:49Sample row (Solana SOL→USDC take_profit):| 17262791359882688 | Active | Take Profit | 0.2 SOL | 9xQeWv...vEjz | 16 USD | $80 | 05/15/2026 17:50:49 |Address shortening rules:- EVM (prefix): first 6 chars (
0x+ 4) +0x+ last 4 chars... - Solana / other non-prefixed base58: first 6 + + last 4
... - Strings shorter than 10 chars: do not truncate; display verbatim
Expire timezone conversion:- from BE is a UTC millisecond timestamp
expireTime - The agent must convert to the user's current local timezone at render time (e.g. JS , Rust
Intl.DateTimeFormat, or equivalent)chrono::Local - Fixed format: , 24-hour clock
MM/DD/YYYY HH:MM:SS
- EVM (
-
After the table, append a single combined reminder covering pagination + status filter. Include the pagination line only whenis non-empty.
nextCursorCanonical EN; the agent translates per §Display labels & output language:Showing live orders by default (10 per page).- Reply "next page" to load more.
- To filter by a specific state, ask for orders by their Display label — e.g. ,
Completed,Cancelled,Failed. Example: "show my completed orders" → I'll re-query with that filter.Expired
Ifis empty (no more pages), drop the "next page" bullet and keep only the status-filter bullet.nextCursor -
If the user replies "next page" / similar, re-run withcarrying the previous response's
--limit 10 --cursor <nextCursor>. Render with the same table format.nextCursor -
If the user names a specific status (any of the 9 Display labels), re-run as(single value) and render the same table. Drop the status-filter bullet from the reminder; keep the pagination bullet if
list --limit 10 --status <label>is non-empty.nextCursor
符合此规则的用户提示包括:"查看我的策略订单" / "列出订单" / "查看我的限价单" / "我有哪些订单"——即任何无状态限定的"查看我的订单"通用意图。
Agent必须遵循以下步骤:
-
运行(无
onchainos strategy list --limit 10)——CLI会在请求体中传入--status(非终态集合);后端会在服务器端应用此筛选,仅返回匹配的订单。通用"查看我的订单"查询必须始终传递orderStatusList=[-3, 0, 2, 3, 4];分页需通过"下一页"后续请求触发。--limit 10 -
将响应渲染为Markdown表格,必须包含以下8列(固定):
data.list订单ID 订单状态 订单类型 预估数量 买入代币地址 价值 触发价 到期时间 每行映射(列顺序固定,不得添加额外列):列 来源 说明 订单ID data.list[i].orderId— 订单状态 (根据§data.list[i].statusLabel表生成的显示标签)status根据§显示标签与输出语言的规则翻译 订单类型 根据§ 表生成的显示标签,由strategyType整数值推导(data.list[i].strategyType/2 → 抄底/3 → 止盈/4 → 止损)5 → 追高买入根据§显示标签与输出语言的规则翻译 预估数量 +data.list[i].toToken.tokenAmount+data.list[i].toToken.tokenSymbol例如 0.2 SOL买入代币地址 ,截断为前6位 + 后4位data.list[i].toToken.tokenContractAddressEVM: (0x1234...cdef+ 4个字符 +0x+ 4个字符);Solana base58:前6位 +...+ 后4位...价值 ,格式化为data.list[i].toToken.tokenUsd<n> USD例如 (四舍五入或保留两位小数,遵循后端精度)16 USD触发价 ,前缀添加data.list[i].triggerInfo.triggerPrice$例如 ;若为空(触发率路径,第一阶段未使用)则显示$80data.list[i].triggerInfo.triggerRate到期时间 (13位毫秒级UTC时间戳),转换为用户当前时区,格式为data.list[i].expireTimeMM/DD/YYYY HH:MM:SS例如 (语义上默认=创建时间+7天)05/15/2026 17:50:49示例行(Solana SOL→USDC止盈单):| 17262791359882688 | 活跃中 | 止盈 | 0.2 SOL | 9xQeWv...vEjz | 16 USD | $80 | 05/15/2026 17:50:49 |地址截断规则:- EVM(前缀):前6个字符(
0x+ 4个字符) +0x+ 后4个字符... - Solana / 其他无前缀base58地址:前6位 + + 后4位
... - 长度小于10的字符串:不截断,完整显示
到期时间时区转换:- 后端返回的是UTC毫秒时间戳
expireTime - Agent必须在渲染时转换为用户当前本地时区(例如JS 、Rust
Intl.DateTimeFormat或等效工具)chrono::Local - 固定格式:,24小时制
MM/DD/YYYY HH:MM:SS
- EVM(
-
在表格后添加合并提示,包含分页+状态筛选说明。仅当非空时才包含分页提示。
nextCursor标准英文表述;Agent需根据§显示标签与输出语言的规则翻译:默认显示活跃订单(每页10条)。- 回复"下一页"加载更多。
- 若要按特定状态筛选,请按显示标签查询订单——例如、
已完成、已取消、已失败。示例:"查看我的已完成订单" → 我会使用该筛选重新查询。已过期
若为空(无更多页),则移除"下一页"项目符号,仅保留状态筛选提示。nextCursor -
若用户回复"下一页"等,重新运行,传入上一次响应中的
list --limit 10 --cursor <nextCursor>。使用相同表格格式渲染。nextCursor -
若用户指定了具体状态(9种显示标签中的任意一种),重新运行(单个值)并使用相同表格渲染。移除提示中的状态筛选项目符号;若
list --limit 10 --status <label>非空则保留分页提示。nextCursor
4. onchainos strategy resume
onchainos strategy resume4. onchainos strategy resume
onchainos strategy resumeonchainos strategy resume # auto-discover all SUSPENDED + canResume=true on active wallet
onchainos strategy resume --order-ids id1,id2 # explicitWhen ids are omitted, the CLI runs filtered to and keeps only orders whose flag is true; the discovered ids are then submitted to . After resume, the agent should advise the user that orders whose trigger condition was already met may execute immediately — re-query with to confirm.
liststatus=4canResumereactivatelistonchainos strategy resume # 自动发现当前钱包中所有状态为SUSPENDED且canResume=true的订单
onchainos strategy resume --order-ids id1,id2 # 显式指定订单若省略订单ID,CLI会运行并筛选的订单,仅保留为true的订单;然后将发现的订单ID提交至接口。恢复后,Agent应告知用户:已满足触发条件的订单可能会立即执行——请用重新查询以确认状态。
liststatus=4canResumereactivatelistError code → Agent action
错误码 → Agent操作
The CLI surfaces the BE error code in human-readable form. Map each code to a recommended next step:
| Code | Name | What the agent should do |
|---|---|---|
| 100 | REQUEST_PARAM_ERROR | Surface the BE message; ask the user to fix the offending flag |
| 10019 | INSUFFICIENT_NATIVE_GAS_BALANCE | Wallet's native token balance is below the BE-required minimum (the response msg includes |
| 10026 | JWT_TOKEN_VERIFY_FAILED | Suggest |
| 10106 | CHAIN_NOT_SUPPORT_ERROR | Tell the user the chain is not supported; suggest a supported alternative |
| 60002 | NO_ORDER_FOUND | Cancel/resume target id is wrong or already terminal — suggest |
| 60003 | LIMIT_ORDER_NO_AUTHORITY | Trader Mode may not be activated yet; the next CLI call will trigger SD-A automatically — retry once |
| 60006 | LIMIT_ORDER_OUT_LIMIT_FAIL | Pending order count is at the per-account limit (max 100); ask the user to cancel some pending orders ( |
| 60009 | LIMIT_ORDER_ILLIQUIDITY_ERROR | No liquidity for the pair at the trigger; suggest a different pair or wider trigger |
| 60014 | LIMIT_ORDER_EXPIRED_CANNOT_OPERATE | Order already expired |
| 60015 | LIMIT_ORDER_PENDING_CANNOT_OPERATE | Order is mid-lifecycle; wait for terminal state |
| 60017 | LIMIT_ORDER_SUCCESS_CANNOT_OPERATE | Order already completed |
| 60018 | LIMIT_ORDER_TEE_SA_VERSION_UPGRADE_REQUIRED | Transparent — CLI handles via SD-A retry; the agent should NOT see this code in normal flow. If it leaks, just retry the same command |
| 60030 | QUOTA_EXCEEDED | Account-level quota reached |
| 100005 | WALLET_ADDRESS_BLACKLISTED | Wallet address flagged by risk control; ask the user to contact support — do not retry |
| 100007 | TEE_SIGN_FAILURE | Transient TEE issue — retry once |
| 100010 | ORDER_AMOUNT_TOO_SMALL | Order value is below the BE-enforced minimum of $1 USD. Ask the user to increase |
| 100008 | TEE_SERVICE_UNAVAILABLE | TEE service is temporarily unavailable; ask the user to retry later |
| 100012 | LIMIT_ORDER_INSUFFICIENT_BALANCE | Insufficient balance; suggest checking with |
Match by integer code, not msg string. The msg text is for humans and may change.
CLI会以人类可读形式展示后端错误码。请将每个错误码映射至推荐的后续操作:
| 错误码 | 名称 | Agent应执行的操作 |
|---|---|---|
| 100 | REQUEST_PARAM_ERROR | 展示后端错误信息;请用户修正对应的参数 |
| 10019 | INSUFFICIENT_NATIVE_GAS_BALANCE | 钱包原生代币余额低于后端要求的最小值(响应信息包含 |
| 10026 | JWT_TOKEN_VERIFY_FAILED | 建议用户执行 |
| 10106 | CHAIN_NOT_SUPPORT_ERROR | 告知用户该链不支持;建议使用支持的替代链 |
| 60002 | NO_ORDER_FOUND | 取消/恢复的目标订单ID错误或已进入终态——建议用户使用 |
| 60003 | LIMIT_ORDER_NO_AUTHORITY | 交易员模式可能尚未激活;下一次CLI调用会自动触发SD-A——重试一次 |
| 60006 | LIMIT_ORDER_OUT_LIMIT_FAIL | 挂单数量已达账户上限(最多100个);请用户取消部分挂单( |
| 60009 | LIMIT_ORDER_ILLIQUIDITY_ERROR | 触发价下该交易对无流动性;建议更换交易对或扩大触发价范围 |
| 60014 | LIMIT_ORDER_EXPIRED_CANNOT_OPERATE | 订单已过期 |
| 60015 | LIMIT_ORDER_PENDING_CANNOT_OPERATE | 订单处于中间生命周期;等待进入终态 |
| 60017 | LIMIT_ORDER_SUCCESS_CANNOT_OPERATE | 订单已完成 |
| 60018 | LIMIT_ORDER_TEE_SA_VERSION_UPGRADE_REQUIRED | 自动处理——CLI会通过SD-A重试;正常流程下Agent不会看到此错误码。若意外出现,只需重试相同命令即可 |
| 60030 | QUOTA_EXCEEDED | 账户级配额已达上限 |
| 100005 | WALLET_ADDRESS_BLACKLISTED | 钱包地址被风控标记;请用户联系客服——不得重试 |
| 100007 | TEE_SIGN_FAILURE | TEE临时问题——重试一次 |
| 100010 | ORDER_AMOUNT_TOO_SMALL | 订单价值低于后端强制执行的1美元最小值。请用户提高 |
| 100008 | TEE_SERVICE_UNAVAILABLE | TEE服务暂时不可用;请用户稍后重试 |
| 100012 | LIMIT_ORDER_INSUFFICIENT_BALANCE | 余额不足;建议用户使用 |
请按整数错误码匹配,而非错误信息字符串。 错误信息面向人类,可能会变更。
Execution event codes (executionHistoryList[].code
)
executionHistoryList[].code执行事件码(executionHistoryList[].code
)
executionHistoryList[].codeA separate stream from the BE error codes above. Emitted by the TEE swap-trade engine while it attempts to execute an active order. Read the latest entry first; older entries are historical context.
CLI enriches each entry directly — no sidecar table needed. For every code the CLI recognises (35+ codes covering the 3xxx active series + 2xxx legacy series), and detail responses inject three fields next to the raw :
listcode| Field | Source | Use |
|---|---|---|
| Catalog ( | Internal label; do NOT surface to the user |
| Catalog — matches OKX wallet UI wording | Surface verbatim to the user (translate per §Display labels & output language) |
| Catalog | |
For codes the CLI does not recognise (BE added a new code we haven't catalogued yet), the entry passes through unchanged — / / are absent and the agent should surface the raw BE field if present, or fall back to .
namemessageterminalmsg"event code <N>"与上述后端错误码为独立流。由TEE兑换交易引擎在尝试执行活跃订单时触发。请先查看最新条目;旧条目仅为历史上下文。
CLI会直接丰富每个条目——无需额外表格。对于CLI可识别的所有代码(35+种,涵盖3xxx活跃系列+2xxx legacy系列),和详情响应会在原始旁注入三个字段:
listcode| 字段 | 来源 | 用途 |
|---|---|---|
| 目录( | 内部标签;不得向用户展示 |
| 目录——与OKX钱包UI表述一致 | 直接向用户展示(根据§显示标签与输出语言的规则翻译) |
| 目录 | |
对于CLI无法识别的代码(后端新增了未收录的代码),条目会直接透传——无 / / 字段;若后端返回了字段,Agent可展示该字段;否则 fallback 至。
namemessageterminalmsg"事件码<N>"Reading patterns
解读模式
- Latest entry wins. Render the most recent item; older entries are historical context only.
executionHistoryList[] - Repeated same code. When the same code recurs every ~10s without a appearing, the engine is in a soft retry loop. Surface the latest
txHash, mention the repeat count ("this is the 5thmessageevent"), and ask the user whether to wait, cancel, or adjust parameters.No quote due to low liquidity - codes. Stop polling immediately and surface to the user; engine will not retry.
terminal=true - codes that repeat 3+ times. Treat as user-actionable: suggest changing slippage / amount / pair / chain, or cancelling.
terminal=false - Code with
0. Trade succeeded; surfacetxHashand explorer link.txHash
- 最新条目优先。渲染中最新的条目;旧条目仅作为历史上下文。
executionHistoryList[] - 重复相同代码。当相同代码每10秒左右重复出现且未生成时,引擎处于软重试循环。展示最新的
txHash,提及重复次数("这是第5次message事件"),并询问用户是否等待、取消或调整参数。因流动性不足无法获取报价 - 代码。立即停止轮询并向用户展示;引擎不会重试。
terminal=true - 代码重复3次及以上。视为需要用户操作:建议调整滑点/金额/交易对/链,或取消订单。
terminal=false - 代码且带有
0。交易成功;展示txHash和浏览器链接。txHash
Action hints by hot code
热门代码对应的操作提示
The field is the user-facing string. The agent additionally chooses one of these action hints based on :
messagecode| code | what the agent should do |
|---|---|
| 0 | report success; surface |
| 3013 | suggest topping up the from-token or recreating with smaller amount |
| 3014 | tell user to fund the chain's native fee token (SOL / ETH / BNB / ...) |
| 3015 | suggest widening |
| 3016 | non-transient — suggest different pair, smaller amount, wider trigger, or different chain |
| 3017 | engine retries; if recurring 3+ times, treat like 3016 |
| 3019 | terminal — destination token is blocklisted; order will not execute |
| 3020 | terminal — wallet address is flagged; surface explicitly |
| 3023 | recreate with longer |
Codes outside this table: read from the CLI output. ⇒ surface and stop. ⇒ surface and wait one more cycle.
terminalterminal=trueterminal=falsemessagecode| 代码 | Agent应执行的操作 |
|---|---|
| 0 | 报告成功;展示 |
| 3013 | 建议用户补充卖出代币或创建金额更小的订单 |
| 3014 | 告知用户为该链的原生手续费代币(SOL / ETH / BNB等)充值 |
| 3015 | 建议扩大 |
| 3016 | 非临时问题——建议更换交易对、减小金额、扩大触发价范围或更换链 |
| 3017 | 引擎会重试;若重复3次及以上,按3016处理 |
| 3019 | 终态——目标代币被封禁;订单无法执行 |
| 3020 | 终态——钱包地址被标记;明确告知用户 |
| 3023 | 创建订单时设置更长的 |
不在此表中的代码:从CLI输出读取值。 ⇒ 展示并停止。 ⇒ 展示并等待下一轮。
terminalterminal=trueterminal=falseAsync wait pattern
异步等待模式
create-limitcancelresumeestimatedWaitTimeAgent recipe (locked):
- Run the subcommand.
- Sleep 3 seconds. A single fixed 3-second wait is enough across all supported chains in practice — empirically validated 2026-05-11. Do not read from the response and sleep by that value; the BE-supplied number is conservative and inflates the wait unnecessarily (especially on ETH-class chains).
estimatedWaitTime - Re-query with to read the final state.
onchainos strategy list --order-id <orderId> - If still pending after the first re-query, surface the partial state to the user; do not loop indefinitely.
Do not run a long polling loop. The CLI is not designed for that; the BE backs the order finalisation off-chain and one targeted re-query is sufficient in normal conditions.
create-limitcancelresumeestimatedWaitTimeAgent流程(固定):
- 运行子命令。
- 等待3秒。在所有支持的链上,单次固定等待3秒已足够——2026-05-11经验证有效。不得读取响应中的并按该值等待;后端提供的数值较为保守,会不必要地延长等待时间(尤其是ETH类链)。
estimatedWaitTime - 使用重新查询以读取最终状态。
onchainos strategy list --order-id <orderId> - 若第一次重新查询后仍处于挂起状态,向用户展示部分状态;不得无限循环轮询。
不得运行长轮询循环。CLI并非为此设计;后端在链下处理订单终态,正常情况下一次定向重新查询已足够。
SA activation transparency
SA激活透明化
Trader Mode upgrade / re-upgrade is performed transparently by the CLI:
- On or
create-limit, if the BE returns coderesume(60018), the CLI calls the Agentic Wallet attestation endpoints (UPGRADE_REQUIRED→ ed25519 sign with the session key →getAttestDocHex), then retries the original op once. On success the user seesregisterTeeInfofollowed by the normal command output.Trader Mode activated. - The agent should not ask the user to "activate Trader Mode" first — the CLI does it on demand.
- If activation fails, the original command aborts and the activation error is surfaced. Suggest to inspect the session.
onchainos wallet status
交易员模式升级/重新升级由CLI自动执行:
- 在或
create-limit时,若后端返回错误码resume(60018),CLI会调用Agentic Wallet认证端点(UPGRADE_REQUIRED→ 使用会话密钥进行ed25519签名 →getAttestDocHex),然后重试原操作一次。成功后用户会看到registerTeeInfo,随后显示正常命令输出。已激活交易员模式。 - Agent无需要求用户"先激活交易员模式"——CLI会按需执行。
- 若激活失败,原命令会终止并展示激活错误。建议用户执行检查会话状态。
onchainos wallet status
Output format conventions
输出格式约定
All strategy subcommands always emit the standard onchainos JSON envelope on stdout. There is no flag — strategy CLI is agent-facing, so structured JSON is the only output and the agent renders any user-visible tables (e.g. the § 8-column Markdown table) from that JSON.
{ok: true, data: { ... }}--formatlist所有策略子命令始终在标准输出中输出标准onchainos JSON信封。无参数——策略CLI面向Agent,因此结构化JSON是唯一输出格式;Agent需从此JSON渲染所有用户可见表格(例如§命令的8列Markdown表格)。
{ok: true, data: { ... }}--formatlistPhase 1 limitations
第一阶段限制
| Item | Phase 1 status |
|---|---|
Symbol → address resolution for | Not in scope; pass token addresses directly |
| Custom preset (advanced fee tiers, dexId filter) | Default preset only — Phase 2. MEV protection is already supported via |
| Events stream / cursor consumption | |
| Pass-through to BE default; CLI does not pre-filter |
| Multi-account batch | Out of scope; CLI uses the active account only |
| Intentionally not implemented. SA activation / expiry is handled transparently inside the 60018 (UPGRADE_REQUIRED) flow — the CLI runs SD-A and retries silently. The agent does not need to query SA state up-front; just call the intended subcommand and let the CLI handle activation on demand. |
| 项 | 第一阶段状态 |
|---|---|
| 不在范围内;直接传递代币地址 |
| 自定义预设(高级手续费档位、dexId筛选) | 仅支持默认预设——第二阶段实现。已通过 |
| 事件流/游标消费 | |
| 透传至后端默认值;CLI不做前置筛选 |
| 多账户批量操作 | 不在范围内;CLI仅使用当前账户 |
| 故意未实现。SA激活/过期在60018(UPGRADE_REQUIRED)流程中自动处理——CLI会运行SD-A并静默重试。Agent无需提前查询SA状态;只需调用目标子命令,CLI会按需处理激活。 |
| ", |