mcpField
P
pionex-earn-dual

pionex-earn-dual

github.com/pionex-official其他5114 次安装14 周前更新
代码仓库

关于 pionex-earn-dual

这是一项通过 pionex-trade-cli 管理 Pionex Dual Investment 产品的技能,涵盖产品与收益查询、投资、撤销待处理投资和领取已结算收益,并为写入操作提供 dry-run 与确认保护。

主要功能

  1. 01浏览产品和支持的交易对
  2. 02查询收益率、指数和交割价格
  3. 03查看余额、投资和记录
  4. 04投资、撤销投资及领取收益
  5. 05写入命令的 dry-run 防护

适用场景

  1. 01查看可用的 Dual Investment 产品及收益率
  2. 02核对当前收益率后提交投资
  3. 03检查并撤销待处理投资
  4. 04核实已结算订单并领取收益

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/pionex-official/pionex-skills --skill pionex-earn-dual

安装后在 Claude Code 中输入/pionex-earn-dual确认已加载。

详细介绍

Pionex Earn 双币投资技能

Pionex 上的双币投资产品:浏览产品、查看收益率、投资、撤销投资,并领取结算收益,通过 pionex-trade-cli 操作。公开查询无需凭证;写入操作需要具有 Earn 权限的 API 凭证。

Beta 通知: 双币投资 API 目前处于 Beta 阶段。请联系 [email protected] 申请访问权限。

产品 ID 格式: {BASE}-{QUOTE}-{YYMMDD}-{STRIKE}-{C|P}-{CURRENCY},其中 C = DUAL_BASE,P = DUAL_CURRENCY。

技能路由

  • 双币投资产品、价格、投资、撤销、领取 → pionex-earn-dual(本技能)
  • 套利(InstFund)产品、申购、赎回 → pionex-earn-arbitrage
  • 现货市场数据(深度、行情、K 线) → pionex-market
  • 现货账户余额 → pionex-portfolio
  • 现货下单/撤单 → pionex-trade
  • Futures Grid Bot 生命周期 → pionex-bot

前置条件

  1. 安装 CLI:
    npm install -g @pionex/pionex-ai-kit
    
  2. 对于私有命令(余额、投资、revoke_invest、collect),请配置凭证:
    pionex-ai-kit onboard
    
    确保 API 密钥具有所需权限:
    • View — 用于 balances、get_invests、records
    • Earn — 用于 invest、revoke_invest、collect
  3. 验证(公开操作,无需身份验证):
    pionex-trade-cli earn dual symbols
    

命令索引

公开命令(无需身份验证)
#命令标志类型
1pionex-trade-cli earn dual symbols[--base <currency>]READ
2pionex-trade-cli earn dual open_products--base <c> --quote <c> --type DUAL_BASE|DUAL_CURRENCY [--currency <c>]READ
3pionex-trade-cli earn dual prices--base <c> --quote <c> --product-ids <id1,id2,...>READ
4pionex-trade-cli earn dual index--base <c> --quote <c>READ
5pionex-trade-cli earn dual delivery_prices--base <c> [--quote <c>] [--start-time <ms>] [--end-time <ms>]READ
私有命令 — View 权限
#命令标志类型
6pionex-trade-cli earn dual balances[--merge]READ
7pionex-trade-cli earn dual get_invests[--base <c>] --client-dual-ids <id1,id2,...>READ
8pionex-trade-cli earn dual records--base <c> --end-time <ms> [--quote <c>] [--currency <c>] [--start-time <ms>] [--limit <n>]READ
私有命令 — Earn 权限
#命令标志类型
9pionex-trade-cli earn dual invest--base <c> --product-id <id> --profit <rate> (--base-amount <n> | --currency-amount <n>) [--client-dual-id <id>] [--dry-run]WRITE
10pionex-trade-cli earn dual revoke_invest--base <c> --product-id <id> --client-dual-id <id> [--dry-run]WRITE
11pionex-trade-cli earn dual collect--base <c> --client-dual-id <id> --product-id <id> [--dry-run]WRITE

quote 和 currency 规则

正确的 --quote 值取决于基础货币:

基础货币--quote--currency 选项
BTC、ETHUSDXOUSDT 或 USDC
其他所有基础货币(XRP、SOL、LRC 等)USDTUSDT

--quote 不正确将返回 DUAL_PARAMETER_ERROR: invalid base quote。


产品类型说明

类型投入到期时触及行权价未触及行权价
DUAL_BASE(产品 ID 中的 C)基础货币(例如 BTC)转换为投资货币 + 收益以基础货币 + 收益返还
DUAL_CURRENCY(产品 ID 中的 P)投资货币(例如 USDT)转换为基础货币 + 收益以投资货币 + 收益返还

安全规则

  1. 绝不使用过期的 profit 值 — 始终在调用 earn dual invest 前立即调用 earn dual prices。API 会拒绝不匹配的 profit 值。投资工作流的步骤 2 和步骤 3 必须连续执行。
  2. invest 必须提供 --profit — 没有默认值;必须传入 prices 返回的确切值。
  3. 绝不要同时提供 --base-amount 和 --currency-amount — 两者互斥;只能使用其中一个。
  4. 先试运行,确认后再实际执行 — 对于 invest、revoke_invest 和 collect,始终先使用 --dry-run 运行,并向用户展示输出,然后在确认后再不带此参数运行。
  5. 绝不推断 --client-dual-id — 要求用户提供,或提出一个值并征得确认。它用作幂等键。
  6. 撤销或领取前检查订单状态 — 先使用 earn dual get_invests 验证状态:revoke_invest 仅适用于待处理订单;collect 仅适用于已结算订单。
  7. 绝不推断 --product-id、行权价或到期时间 — 这些信息必须来自 API(open_products 或 get_invests),不得自行假设。

投资工作流(强制执行 3 步流程)

步骤 1:获取可用产品
# DUAL_BASE: invest in BTC, payout converted if price rises above strike
pionex-trade-cli earn dual open_products \
  --base BTC \
  --quote USDXO \
  --type DUAL_BASE \
  --currency USDT

# DUAL_CURRENCY: invest in USDT, buy BTC if price drops below strike
pionex-trade-cli earn dual open_products \
  --base BTC \
  --quote USDXO \
  --type DUAL_CURRENCY \
  --currency USDT

从响应中选择一个 productId(例如 BTC-USDXO-260402-68000-P-USDT)。

步骤 2:获取当前收益率(必须紧接步骤 3 之前执行)
pionex-trade-cli earn dual prices \
  --base BTC \
  --quote USDXO \
  --product-ids BTC-USDXO-260402-68000-P-USDT

检查 canInvest: true,并准确记录返回的 profit 值(例如 "0.0039")。

步骤 3:试运行、确认,然后提交
# Dry-run first — shows the request payload without executing
pionex-trade-cli earn dual invest \
  --base BTC \
  --product-id BTC-USDXO-260402-68000-P-USDT \
  --client-dual-id my-order-001 \
  --currency-amount 100 \
  --profit 0.0039 \
  --dry-run

# After user confirmation, submit (same command without --dry-run)
pionex-trade-cli earn dual invest \
  --base BTC \
  --product-id BTC-USDXO-260402-68000-P-USDT \
  --client-dual-id my-order-001 \
  --currency-amount 100 \
  --profit 0.0039

步骤 2 和步骤 3 之间不要调用其他命令。 profit 值的有效期很短。


示例

浏览产品
# All supported pairs
pionex-trade-cli earn dual symbols

# BTC pairs only
pionex-trade-cli earn dual symbols --base BTC

# Open DUAL_BASE products for ETH (invest ETH, convert to USDT if price rises)
pionex-trade-cli earn dual open_products \
  --base ETH --quote USDXO --type DUAL_BASE --currency USDT

# Open products for XRP (non-BTC/ETH — use USDT quote)
pionex-trade-cli earn dual open_products \
  --base XRP --quote USDT --type DUAL_BASE
检查价格和指数
# Current yield for a specific product
pionex-trade-cli earn dual prices \
  --base BTC --quote USDXO \
  --product-ids BTC-USDXO-260402-68000-P-USDT

# Multiple product IDs (comma-separated, no spaces)
pionex-trade-cli earn dual prices \
  --base ETH --quote USDXO \
  --product-ids ETH-USDXO-260410-3000-C-USDT,ETH-USDXO-260410-2900-C-USDT

# Real-time index price
pionex-trade-cli earn dual index --base BTC --quote USDXO

# Historical delivery prices
pionex-trade-cli earn dual delivery_prices --base BTC --quote USDXO
账户和历史记录
# Balances
pionex-trade-cli earn dual balances

# Merged balances (same coin across different bases)
pionex-trade-cli earn dual balances --merge

# Batch query by client order IDs (comma-separated)
pionex-trade-cli earn dual get_invests \
  --base BTC \
  --client-dual-ids my-order-001,my-order-002

# Investment history (--base and --end-time required)
pionex-trade-cli earn dual records \
  --base BTC \
  --quote USDXO \
  --end-time 1775027817297 \
  --limit 20
撤销待处理订单
# 1. Verify order is still pending
pionex-trade-cli earn dual get_invests --base BTC --client-dual-ids my-order-001

# 2. Dry-run
pionex-trade-cli earn dual revoke_invest \
  --base BTC \
  --product-id BTC-USDXO-260402-68000-P-USDT \
  --client-dual-id my-order-001 \
  --dry-run

# 3. Execute after user confirmation
pionex-trade-cli earn dual revoke_invest \
  --base BTC \
  --product-id BTC-USDXO-260402-68000-P-USDT \
  --client-dual-id my-order-001
领取已结算收益
# 1. Verify order is settled
pionex-trade-cli earn dual get_invests --base BTC --client-dual-ids my-order-001

# 2. Dry-run
pionex-trade-cli earn dual collect \
  --base BTC \
  --client-dual-id my-order-001 \
  --product-id BTC-USDXO-260402-68000-P-USDT \
  --dry-run

# 3. Execute after user confirmation
pionex-trade-cli earn dual collect \
  --base BTC \
  --client-dual-id my-order-001 \
  --product-id BTC-USDXO-260402-68000-P-USDT

评论

支持 Markdown