gate-exchange-options

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Resolving
gate-cli
(binary path)

解析
gate-cli
(二进制文件路径)

Resolve
gate-cli
in order: (1)
command -v gate-cli
and
gate-cli --version
succeeds; (2)
${HOME}/.local/bin/gate-cli
if executable; (3)
${HOME}/.openclaw/skills/bin/gate-cli
if executable. Canonical rules:
exchange-runtime-rules.md
§4 (or
gate-runtime-rules.md
§4).
Read and follow exchange-runtime-rules.md first.
按以下顺序解析**
gate-cli
**:(1) **
command -v gate-cli
gate-cli --version
**执行成功;(2) 若
${HOME}/.local/bin/gate-cli
可执行则使用该路径;(3) 若
${HOME}/.openclaw/skills/bin/gate-cli
可执行则使用该路径。标准规则参见:
exchange-runtime-rules.md
第4节(或
gate-runtime-rules.md
第4节)。
请先阅读并遵循exchange-runtime-rules.md中的内容。

Gate Options Trading

Gate期权交易

This skill is the single entry for Gate options. It supports five operation types: place order (market/limit), place order (mark IV), close/reduce position, cancel open orders, amend open orders. User intent is routed to the matching workflow.
此Skill是Gate期权交易的唯一入口,支持五种操作类型:下单(市价/限价)、基于mark IV下单、平仓/减仓、取消未成交订单、修改未成交订单。用户的意图会被路由至匹配的工作流。

Case coverage (5 cases)

场景覆盖(5种场景)

CaseDescriptionExample triggers (EN)Example output (EN)
Case 1Market/limit place order"Market buy 1 BTC call, strike at current price, expire in one week" / "Sell 1000U weekly BTC call at 70k strike" / "Open long 1 SOL weekly option at market" / "Use half of account to buy BTC call expiring in 3 days""Order submitted! You have placed a {buy/sell} order on {underlying} at {market/limit price}, strike {xxx}, expiration {xxx}, option type {call/put}, size {xxx} contracts."
Case 2Mark IV place order"Mark IV order: buy 1 BTC call, one week expiry" / "Sell 1000U weekly BTC call at 70k strike, mark IV" / "Open long 1 SOL weekly option, mark IV"Same as Case 1, but price is derived from mark IV or IV-to-price backend.
Case 3Market/limit close or reduce position"Market close my BTC call, expiry 03/18, strike 70000" / "Close half of my ETH put at market" / "Close all profitable option positions" / "Market close all options with loss over 50%""Close order submitted! As requested, you have closed {size} of your {long/short} position on {underlying} at {market/limit price}."
Case 4Cancel open orders"Cancel the BTC call order at 70k strike, expiry 03/18" / "Cancel all SOL call buy orders" / "Cancel all open orders" / "One-click cancel""Cancel successful! Your {specified/all} open order(s) have been cancelled. A total of {N} order(s) were cancelled, releasing {xxx} USDT margin."
Case 5Amend open orders"Change my BTC call order at 70k strike, expiry 03/18, price to 0.05" / "Halve the size of my SOL put at strike 70, expiry 03/20""Amend confirmed! Your open order on {underlying} has been updated: price is now {new price}, size is now {new size}. Waiting for fill."
场景描述触发示例(英文)输出示例(英文)
场景1市价/限价下单"Market buy 1 BTC call, strike at current price, expire in one week" / "Sell 1000U weekly BTC call at 70k strike" / "Open long 1 SOL weekly option at market" / "Use half of account to buy BTC call expiring in 3 days""Order submitted! You have placed a {buy/sell} order on {underlying} at {market/limit price}, strike {xxx}, expiration {xxx}, option type {call/put}, size {xxx} contracts."
场景2基于mark IV下单"Mark IV order: buy 1 BTC call, one week expiry" / "Sell 1000U weekly BTC call at 70k strike, mark IV" / "Open long 1 SOL weekly option, mark IV"与场景1输出一致,但价格由mark IV或IV转价格的后端服务生成。
场景3市价/限价平仓或减仓"Market close my BTC call, expiry 03/18, strike 70000" / "Close half of my ETH put at market" / "Close all profitable option positions" / "Market close all options with loss over 50%""Close order submitted! As requested, you have closed {size} of your {long/short} position on {underlying} at {market/limit price}."
场景4取消未成交订单"Cancel the BTC call order at 70k strike, expiry 03/18" / "Cancel all SOL call buy orders" / "Cancel all open orders" / "One-click cancel""Cancel successful! Your {specified/all} open order(s) have been cancelled. A total of {N} order(s) were cancelled, releasing {xxx} USDT margin."
场景5修改未成交订单"Change my BTC call order at 70k strike, expiry 03/18, price to 0.05" / "Halve the size of my SOL put at strike 70, expiry 03/20""Amend confirmed! Your open order on {underlying} has been updated: price is now {new price}, size is now {new size}. Waiting for fill."

Module overview

模块概述

ModuleDescriptionTrigger keywords
Place order (market/limit)Buy or sell options at market or limit pricemarket buy, limit sell, open long, buy call, sell put, spend X on option
Place order (mark IV)Place order by implied volatility (mark IV)mark IV, IV order
Close/reduce positionMarket/limit close or partial closeclose position, flat, reduce half, close all profitable, close losing
Cancel ordersCancel one or all open option orderscancel order, revoke, cancel all, one-click cancel
Amend ordersChange price or size of open orderamend, modify price, change size
模块描述触发关键词
下单(市价/限价)以市价或限价买卖期权market buy, limit sell, open long, buy call, sell put, spend X on option
基于mark IV下单基于隐含波动率(mark IV)下单mark IV, IV order
平仓/减仓市价/限价平仓或部分平仓close position, flat, reduce half, close all profitable, close losing
取消订单取消单个或全部未成交期权订单cancel order, revoke, cancel all, one-click cancel
修改订单修改未成交订单的价格或数量amend, modify price, change size

Routing rules

路由规则

IntentExample phrasesRoute to
Place order (market/limit)"Market buy 1 BTC call, strike at current price, expire in one week" / "Sell 1000U of weekly BTC call at 70k strike" / "Open long 1 SOL weekly option at market" / "Use half of account to buy BTC call expiring in 3 days"Read
references/place-order.md
Place order (mark IV)"Mark IV order: buy 1 BTC call, one week expiry" / "Sell 1000U weekly BTC call at 70k strike, mark IV" / "Open long 1 SOL weekly option, mark IV"Read
references/place-order.md
Close/reduce position"Market close my BTC call, expiry MM/DD, strike XXXX" / "Close half of ETH put at market" / "Close all BTC call long when price hits 60000" / "Market close all profitable option positions"Read
references/close-position.md
Cancel orders"Cancel the BTC call order at 70k strike, expiry MM/DD" / "Cancel all SOL call buy orders" / "Cancel all open orders"Read
references/cancel-order.md
Amend orders"Change my BTC call order at 70k strike, expiry MM/DD, price to XXXX" / "Halve the size of my SOL put at strike 70, expiry MM/DD"Read
references/amend-order.md
Unclear"Help with options", "Show my option positions"Clarify: query positions/orders, then guide user
意图示例短语路由至
下单(市价/限价)"Market buy 1 BTC call, strike at current price, expire in one week" / "Sell 1000U of weekly BTC call at 70k strike" / "Open long 1 SOL weekly option at market" / "Use half of account to buy BTC call expiring in 3 days"阅读
references/place-order.md
基于mark IV下单"Mark IV order: buy 1 BTC call, one week expiry" / "Sell 1000U weekly BTC call at 70k strike, mark IV" / "Open long 1 SOL weekly option, mark IV"阅读
references/place-order.md
平仓/减仓"Market close my BTC call, expiry MM/DD, strike XXXX" / "Close half of ETH put at market" / "Close all BTC call long when price hits 60000" / "Market close all profitable option positions"阅读
references/close-position.md
取消订单"Cancel the BTC call order at 70k strike, expiry MM/DD" / "Cancel all SOL call buy orders" / "Cancel all open orders"阅读
references/cancel-order.md
修改订单"Change my BTC call order at 70k strike, expiry MM/DD, price to XXXX" / "Halve the size of my SOL put at strike 70, expiry MM/DD"阅读
references/amend-order.md
意图不明确"Help with options", "Show my option positions"澄清:查询仓位/订单,然后引导用户

Tool mapping

工具映射

All options tools use the
cex_options_
prefix. See gate-mcp tools.
GroupMCP tools
Underlying & contracts
gate-cli cex options market underlyings
,
gate-cli cex options market expirations
,
gate-cli cex options market contracts
,
gate-cli cex options market contract
Market data
gate-cli cex options market order-book
,
gate-cli cex options market tickers
Account & positions
gate-cli cex options account get
,
gate-cli cex options position list
Orders
gate-cli cex options order list
,
gate-cli cex options order create
,
gate-cli cex options order cancel
,
gate-cli cex options order cancel-all
Amend
gate-cli cex options order amend
Trades
gate-cli cex options position my-trades
所有期权工具均使用
cex_options_
前缀,详情参见gate-mcp tools
分组MCP工具
标的与合约
gate-cli cex options market underlyings
,
gate-cli cex options market expirations
,
gate-cli cex options market contracts
,
gate-cli cex options market contract
市场数据
gate-cli cex options market order-book
,
gate-cli cex options market tickers
账户与仓位
gate-cli cex options account get
,
gate-cli cex options position list
订单
gate-cli cex options order list
,
gate-cli cex options order create
,
gate-cli cex options order cancel
,
gate-cli cex options order cancel-all
修改订单
gate-cli cex options order amend
交易记录
gate-cli cex options position my-trades

Authentication

身份验证

  • Interactive file setup: when
    GATE_API_KEY
    and
    GATE_API_SECRET
    are not both set on the host, run
    gate-cli config init
    to complete the wizard for API key, secret, profiles, and defaults (see gate-cli).
  • Env / flags:
    gate-cli config init
    is not required when credentials are already supplied — e.g. both
    GATE_API_KEY
    and
    GATE_API_SECRET
    set on the host, or
    --api-key
    /
    --api-secret
    where supported — never ask the user to paste secrets into chat.
  • Permissions: Options:Write (and reads as required for quotes/positions); use least privilege consistent with this skill.
  • Portal: create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage
  • 交互式文件配置:当主机上未同时设置**
    GATE_API_KEY
    GATE_API_SECRET
    时,运行
    gate-cli config init
    **完成API密钥、密钥、配置文件及默认设置的向导配置(参见gate-cli)。
  • 环境变量/参数:若已提供凭证,则无需运行**
    gate-cli config init
    ——例如主机上已同时设置
    GATE_API_KEY
    GATE_API_SECRET
    ,或在支持的情况下使用
    --api-key
    ** / **
    --api-secret
    **参数——切勿要求用户在聊天中粘贴密钥。
  • 权限:期权交易需具备Options:Write权限(以及获取报价/仓位所需的读取权限);遵循最小权限原则。
  • 门户:在聊天外创建或轮换密钥:https://www.gate.com/myaccount/profile/api-key/manage

Installation Check

安装检查

  • Required:
    gate-cli
    (install from gate-cli releases or via a Gate MCP / skills installer for your environment).
  • Add the directory containing
    gate-cli
    to
    PATH
    when invoking by name.
  • Credentials: When
    GATE_API_KEY
    and
    GATE_API_SECRET
    are both set (non-empty) for the host, do not require
    gate-cli config init
    . When both are unset or empty, remind the operator to run
    gate-cli config init
    or to configure
    GATE_API_KEY
    /
    GATE_API_SECRET
    in the matching skill from the skill library (never ask the user to paste secrets into chat).
  • Sanity check: Do not proceed with authenticated or mutating calls until the CLI works as expected (e.g.
    gate-cli cex options market tickers
    or
    gate-cli --version
    ); confirm credentials resolve before orders.
  • 必需组件
    gate-cli
    (从gate-cli releases下载安装,或通过适用于您环境的Gate MCP / Skill安装程序安装)。
  • 调用
    gate-cli
    时,需将包含**
    gate-cli
    的目录添加至
    PATH
    **环境变量。
  • 凭证检查:当主机上的**
    GATE_API_KEY
    GATE_API_SECRET
    均已设置(非空)时,无需要求运行
    gate-cli config init
    。当两者均未设置或为空时,提醒操作人员运行
    gate-cli config init
    ,或从Skill库中的对应Skill配置
    GATE_API_KEY
    ** /
    GATE_API_SECRET
    ——切勿要求用户在聊天中粘贴密钥。
  • 完整性检查:在执行需身份验证或变更操作的调用前,确保CLI可正常工作(例如执行**
    gate-cli cex options market tickers
    gate-cli --version
    **);下单前确认凭证已解析成功。

Execution workflow

执行工作流

1. Intent and parameters

1. 意图与参数提取

  • Determine module (Place / Close / Cancel / Amend).
  • Extract: underlying, expiration, strike, call/put → resolve to exact contract name. Contract format is
    {underlying}-{expiration}-{strike}-{C|P}
    (e.g.
    BTC_USDT-20210916-50000-C
    ). Use
    list_options_contracts
    or
    get_options_contract
    .
  • Missing: if required params missing (e.g. strike or expiration), ask user (clarify mode).
  • 确定模块(下单/平仓/取消/修改)。
  • 提取:标的、到期日、行权价、看涨/看跌期权 → 解析为准确的合约名称。合约格式为
    {underlying}-{expiration}-{strike}-{C|P}
    (例如
    BTC_USDT-20210916-50000-C
    )。使用
    list_options_contracts
    get_options_contract
    工具。
  • 参数缺失:若必填参数缺失(如行权价或到期日),询问用户(澄清模式)。

2. Unit conversion (place order only)

2. 单位转换(仅下单场景)

When the user does not specify size in contracts, convert to contracts before placing the order.
User phraseIntentHow to get size (contracts)
ContractsExplicit contract count"1 contract", "buy 3 contracts" → size = 1, 3
Base notionalNotional in underlying"0.1 BTC call", "1 BTC put" → contracts = base_amount / multiplier (from
get_options_contract
)
Quote (USDT)Premium / cost in USDT"1000U", "spend 500 USDT", "half of account" → contracts = usdt_amount / price_per_contract (from order book/ticker)
  • Base notional → contracts:
    contracts = base_amount / multiplier
    . Multiplier = face value of one contract in underlying units (from
    get_options_contract
    ).
  • Quote (USDT) → contracts:
    contracts = usdt_amount / price_per_contract
    . For "half of account", use
    list_options_account
    then half of available balance.
  • Default: When user says "X BTC" or "X ETH" without "contract(s)", treat as base notional and convert. Use explicit "X contracts" for contract count.
  • Precision: Floor to integer; must satisfy
    order_size_min
    from
    get_options_contract
    . If result < order_size_min, inform user.
当用户未以合约数指定数量时,需先转换为合约数再下单。
用户表述意图如何计算合约数
合约数明确指定合约数量"1 contract", "buy 3 contracts" → 数量=1、3
标的名义价值以标的资产计价的名义价值"0.1 BTC call", "1 BTC put" → 合约数=标的金额 / 乘数(来自
get_options_contract
计价货币(USDT)以USDT计价的权利金/成本"1000U", "spend 500 USDT", "half of account" → 合约数=USDT金额 / 每份合约价格(来自订单簿/行情数据)
  • 标的名义价值→合约数
    合约数 = 标的金额 / 乘数
    。乘数为每份合约对应的标的资产面值(来自
    get_options_contract
    )。
  • 计价货币(USDT)→合约数
    合约数 = USDT金额 / 每份合约价格
    。对于“half of account”,使用
    list_options_account
    获取账户可用余额后取一半计算。
  • 默认规则:当用户表述为“X BTC”或“X ETH”且未提及“contract(s)”时,视为标的名义价值并进行转换。需明确使用“X contracts”来指定合约数量。
  • 精度处理:向下取整为整数;需满足
    get_options_contract
    返回的
    order_size_min
    要求。若结果小于
    order_size_min
    ,告知用户。

3. Pre-flight checks

3. 前置检查

  • Contract: call
    get_options_contract
    (or resolve via
    list_options_contracts
    ) to ensure contract exists.
  • Account: for buy, check balance (and for quote-based size, check price_per_contract from order book/ticker).
  • Close/reduce: verify position exists and close size does not exceed position. Full close:
    close: true
    ,
    size: 0
    ; partial:
    reduce_only: true
    and size (negative for long, positive for short).
  • Disambiguation: If "one week" or "3 days" matches multiple expirations, pick nearest or list and ask. If "strike at current price", use underlying index price and pick nearest strike.
  • 合约验证:调用
    get_options_contract
    (或通过
    list_options_contracts
    解析)确保合约存在。
  • 账户余额检查:买入时检查余额(若为基于计价货币的数量,需从订单簿/行情数据获取每份合约价格)。
  • 平仓/减仓检查:验证仓位存在且平仓数量不超过仓位规模。全额平仓:
    close: true
    ,
    size: 0
    ;部分平仓:
    reduce_only: true
    并指定数量(多头为负,空头为正)。
  • 歧义处理:若“one week”或“3 days”匹配多个到期日,选择最近的到期日或列出所有匹配项询问用户。若“strike at current price”,使用标的指数价格并选择最接近的行权价。

4. Confirmation

4. 确认环节

  • Place order: show final order summary (contract, side, size in contracts, price or market, strike, expiration, call/put). Optionally show equivalent base notional or USDT when size was converted. "Reply 'confirm' to place the order." Only after user confirms, call
    create_options_order
    .
  • Close / cancel / amend: show scope and ask for confirmation before executing.
  • 下单:展示最终订单摘要(合约、方向、合约数、价格类型、行权价、到期日、期权类型)。若数量是从标的名义价值或USDT转换而来,可附加说明如“(相当于1 BTC名义价值)”或“(相当于xxx USDT)”。提示:*"回复'confirm'以确认下单。"*仅在用户确认后调用
    create_options_order
  • 平仓/取消/修改:展示操作范围并在执行前请求用户确认。

5. Call tools and output

5. 调用工具与输出

  • Call tools in the order specified in the reference.
  • Output using the response template for that case.
  • 按照参考文档中指定的顺序调用工具。
  • 使用对应场景的响应模板输出结果。

Report template

报告模板

After each operation, output a short standardized result (see Response templates below).
每次操作后,输出简短的标准化结果(参见下方响应模板)。

Response templates

响应模板

Use the English templates below for standardized output.
使用以下英文模板进行标准化输出。

Place order (Case 1 & 2)

下单(场景1&2)

Order submitted! You have placed a {buy/sell} order on {underlying} at {market/limit price / mark IV}, strike {xxx}, expiration {xxx}, option type {call/put}, size {xxx} contracts.
When size was converted from base notional or USDT, optionally add e.g. " (equiv. 1 BTC notional)" or " (equiv. xxx USDT)".
Order submitted! You have placed a {buy/sell} order on {underlying} at {market/limit price / mark IV}, strike {xxx}, expiration {xxx}, option type {call/put}, size {xxx} contracts.
若数量是从标的名义价值或USDT转换而来,可附加说明如“ (equiv. 1 BTC notional)”或“ (equiv. xxx USDT)”。

Close/reduce position (Case 3)

平仓/减仓(场景3)

Close order submitted! As requested, you have closed {size} of your {long/short} position on {underlying} at {market/limit price}.
Close order submitted! As requested, you have closed {size} of your {long/short} position on {underlying} at {market/limit price}.

Cancel orders (Case 4)

取消订单(场景4)

Tools:
  • Cancel all open option orders (one-click / all underlyings):
    gate-cli cex options order cancel-all
    with no params.
  • Cancel a single order:
    gate-cli cex options order cancel
    .
  • List open orders (to find order_id / confirm scope):
    gate-cli cex options order list
    .
Cancel successful! Your {specified/all} open order(s) have been cancelled. A total of {N} order(s) were cancelled, releasing {xxx} USDT margin.
工具:
  • 一键取消全部未成交期权订单(所有标的):不带参数运行
    gate-cli cex options order cancel-all
  • 取消单个订单:运行
    gate-cli cex options order cancel
  • 查询未成交订单(获取order_id/确认范围):运行
    gate-cli cex options order list
Cancel successful! Your {specified/all} open order(s) have been cancelled. A total of {N} order(s) were cancelled, releasing {xxx} USDT margin.

Amend order (Case 5)

修改订单(场景5)

Amend confirmed! Your open order on {underlying} has been updated: price is now {new price}, size is now {new size}. Waiting for fill.
Amend confirmed! Your open order on {underlying} has been updated: price is now {new price}, size is now {new size}. Waiting for fill.

Safety rules

安全规则

Confirmation

确认要求

  • Place order: show final order summary (contract, side, size in contracts, price/market, strike, expiration, call/put), then ask for confirmation before
    create_options_order
    . Example: "Reply 'confirm' to place the order."
  • Close / cancel / amend (including single-order cancel): show exact scope (contract/order_id, side, size/price where applicable) and ask for confirmation before executing any action that creates/amends/cancels orders.
  • 下单:展示最终订单摘要(合约、方向、合约数、价格类型、行权价、到期日、期权类型),然后请求用户确认后再调用
    create_options_order
    。示例:"Reply 'confirm' to place the order."
  • 平仓/取消/修改(包括单个订单取消):展示明确的操作范围(合约/order_id、方向、相关数量/价格),并在执行任何创建/修改/取消订单的操作前请求用户确认。

Errors

错误处理

Code / situationAction
Insufficient balanceSuggest depositing or reducing size.
Size below
order_size_min
Inform user; do not submit.
Contract not foundConfirm underlying, expiration, strike, call/put; suggest listing contracts.
Order not foundOrder may be filled, cancelled, or wrong id; suggest checking order history.
代码/场景处理方式
余额不足建议充值或减少订单数量。
数量小于
order_size_min
告知用户;不提交订单。
合约不存在确认标的、到期日、行权价、期权类型;建议列出可用合约。
订单不存在订单可能已成交、取消或ID错误;建议查询订单历史。

Other

其他规则

  • Resolve underlying, expiration, strike, call/put to a single contract before create/cancel/amend.
  • Mark IV orders: use backend IV-to-price conversion when available; otherwise clarify with user.
  • Precision: Respect
    order_size_min
    and
    order_price_round
    from
    get_options_contract
    ; round price to
    order_price_round
    .
  • 在创建/取消/修改订单前,需将标的、到期日、行权价、看涨/看跌期权解析为单个合约。
  • 基于mark IV的订单:若后端支持IV转价格则使用该服务;否则向用户澄清。
  • 精度要求:遵循
    get_options_contract
    返回的
    order_size_min
    order_price_round
    ;将价格四舍五入至
    order_price_round
    指定的精度。