okx-defi-portfolio

por okx

Use this skill to 'check my DeFi positions', 'view DeFi holdings', 'show my DeFi portfolio', 'what DeFi am I invested in', 'show my staking positions', 'show my lending positions', 'DeFi balance', 'DeFi 持仓', '查看DeFi持仓', '我的DeFi资产', '持仓详情', '持仓列表', or mentions viewing DeFi holdings, positions, portfolio across protocols — when the user does NOT name a specific DApp. Covers positions overview and per-protocol position detail. Do NOT use for deposit/redeem/claim operations — use...

npx skills add https://github.com/okx/onchainos-skills --skill okx-defi-portfolio

OKX DeFi Portfolio

2 commands for viewing DeFi positions and holdings across protocols and chains.

Skill Routing

  • For DeFi deposit/redeem/claim → use okx-defi-invest
  • For token price/chart → use okx-dex-market
  • For wallet token balances → use okx-wallet-portfolio
  • For DEX spot swap → use okx-dex-swap

Quickstart

# Get DeFi holdings overview across chains
onchainos defi positions \
  --address 0xYourWallet \
  --chains ethereum,bsc,solana

# Get detailed holdings for a specific protocol (analysisPlatformId from positions output)
onchainos defi position-detail \
  --address 0xYourWallet \
  --chain ethereum \
  --platform-id 67890

Command Index

#CommandDescription
1onchainos defi support-chainsGet supported chains for DeFi
2onchainos defi support-platformsGet supported platforms for DeFi
3onchainos defi positions --address <addr> --chains <chains>Get user DeFi holdings overview
4onchainos defi position-detail --address <addr> --chain <chain> --platform-id <id>Get detailed holdings for a protocol

Chain Support

ChainName / AliaseschainIndex
Ethereumethereum, eth1
BSCbsc, bnb56
Polygonpolygon, matic137
Arbitrumarbitrum, arb42161
Basebase8453
X Layerxlayer, okb196
Avalancheavalanche, avax43114
Optimismoptimism, op10
Fantomfantom, ftm250
Suisui784
Trontron, trx195
TONton607
Linealinea59144
Scrollscroll534352
zkSynczksync324
Solanasolana, sol501

Operation Flow

Step 0: Address Resolution

When the user does NOT provide a wallet address, resolve it automatically from the Agentic Wallet before running any defi command:

1. onchainos wallet status          → check if logged in, get active account
2. onchainos wallet addresses       → get addresses grouped by chain category:
                                       - XLayer addresses
                                       - EVM addresses (Ethereum, BSC, Polygon, etc.)
                                       - Solana addresses
3. Match address to target chain:
   - EVM chains → use EVM address
   - Solana     → use Solana address
   - XLayer     → use XLayer address

Rules:

  • If the user provides an explicit address, use it directly — skip this step
  • If wallet is not logged in, ask the user to log in first (→ okx-agentic-wallet) or provide an address manually
  • If the user says "check all accounts" or "all wallets", use wallet balance --all to get all account IDs, then wallet switch <id> + wallet addresses for each account, and query positions for each
  • Always confirm the resolved address with the user before proceeding if the account has multiple addresses of the same type

Step 1: Identify Intent

User saysAction
View positions / portfolio / holdingsonchainos defi positions
View detail for a protocolonchainos defi position-detail
Redeem / claim after viewingSuggest → use okx-defi-invest

Step 2: Collect Parameters

  • Missing wallet address → resolve via Step 0 (wallet status → wallet addresses), or ask user if not logged in
  • Missing chains → ask user which chains to query, or suggest common ones (ethereum, bsc, solana)
  • Missing platform-id → run defi positions first to get analysisPlatformId

Step 3: Display Results

Displaying Positions Results

When displaying defi positions output, you MUST use exactly these columns in this order — no substitutions, no omissions:

#PlatformanalysisPlatformIdChainsPositionsValue(USD)
1Aave V312345ETH,BSC2$120.00

Rules:

  • analysisPlatformId is MANDATORY in every row — users must copy this value to run position-detail
  • Never omit, hide, or replace analysisPlatformId with any other field
  • Never group platforms — show every platform as its own row regardless of value size
  • Raw JSON path: walletIdPlatformList[*].platformList[*] — each element is one platform row
    • platformName → Platform
    • analysisPlatformId → analysisPlatformId
    • networkBalanceList[*].network → Chains (join with comma)
    • investmentCount → Positions
    • currencyAmount → Value(USD)

Displaying Position Detail Results

Output shape: { "ok": true, "data": [ { "walletIdPlatformDetailList": [...] }, ... ] }data is an array. Never call .get() on data directly; iterate over it as a list.

When displaying defi position-detail output, render all tokens in a single flat table with these exact columns:

TypeAssetAmountValue(USD)investmentIdaggregateProductIdToken ContractRewards
SupplyUSDT1.002285$1.0025127719310x970223...70.000080 AVAX
PendingsAVAX0.00000091$0.000012Platform reward

Rules:

  • Each token row is one row; merge in investmentId and aggregateProductId from its parent investment entry
  • investmentId is MANDATORY in every row — users need it for redeem/claim (via okx-defi-invest)
  • aggregateProductId — show if present, otherwise
  • Token Contract: show the full contract address without truncation; show if native/empty
  • Rewards: show pending reward amount + symbol if present, if none; for platform rewards show Platform reward
  • Type: map investType → Supply/Borrow/Stake/Farm/Pool etc; pending rewards row uses Pending
  • Health rate: show separately below the table with warning if healthRate < 1.5

V3 Pool Positions — Extra Fields

For V3 Pool positions (positionList present), show an additional section per position:

tokenIdStatusRangetickLowertickUpper
93828ACTIVE0.892 – 0.992 USDC/DAI-33500-30450
  • tokenId: from positionList[].tokenId
  • positionStatus: ACTIVE or INACTIVE
  • range: from positionList[].range
  • tickLower / tickUpper: from positionList[].rangeInfo.tickLower / rangeInfo.tickUpper
  • These fields are critical for V3 operations (add liquidity, withdraw, collect V3 fees)

investType Reference

investTypeDescription
1Save (savings/yield)
2Pool (liquidity pool)
3Farm (yield farming)
4Vaults
5Stake
6Borrow
7Staking
8Locked
9Deposit
10Vesting

Post-execution Suggestions

Just completedSuggest
defi positions1. View detail → defi position-detail 2. Redeem → okx-defi-invest 3. Claim rewards → okx-defi-invest
defi position-detail1. Redeem position → use okx-defi-invest with investmentId from table 2. Claim rewards → use okx-defi-invest 3. Add more → use okx-defi-invest
defi position-detail (V3 Pool)1. View depth chart → defi depth-price-chart --investment-id <id> (via okx-defi-invest) 2. View price history → defi depth-price-chart --investment-id <id> --chart-type PRICE

Global Notes

  • CRITICAL — Address-chain compatibility: The --address and --chains parameters must be compatible. EVM addresses (0x…) can only query EVM chains; Solana addresses (base58) can only query solana. Never mix them in a single call — the API will return error 84019 (Address format error).
    • 0x… address → only pass EVM chains: ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksync
    • base58 address → only pass solana
    • Sui address → only pass sui
    • Tron address (T…) → only pass tron
    • TON address → only pass ton
    • If the user wants positions across both EVM and Solana, make two separate calls with the respective addresses
  • defi positions uses --chains (plural, comma-separated, e.g. --chains ethereum,bsc) — do NOT use --chain
  • defi position-detail uses --chain (singular) — do NOT use --chains
  • The wallet address parameter is --address for both commands
  • position-detail requires analysisPlatformId from positions output as --platform-id
  • The CLI resolves chain names automatically (ethereum1, bsc56, solana501)

Más skills de okx

okx-agent-identity
okx
We need to translate the given text from English/Chinese to Spanish. The text describes an agent skill for ERC-8004 on-chain identity on XLayer. It includes actions like register, create, update, etc., and roles in multiple languages. The instruction says to preserve product names, protocol names, URLs, numbers, technical terms. So "ERC-8004", "XLayer", "agent", "ASP", "User", etc. should remain as is? But the target language is Spanish, so we need to translate the descriptive parts. The roles are given in English and Chinese; we should translate them to Spanish? The instruction says "preserve product names, protocol names, URLs, numbers, and technical terms." The roles like "User", "ASP", "Evaluator" might be considered technical terms? But they are also common words. The text includes Chinese translations. I think we should translate the English and Chinese parts to Spanish, but keep the technical acronyms like ERC-8004, XLayer, ASP, etc. Also the list of use cases includes
developmentapi
okx-ai-guide
okx
OKX.AI (el sistema económico de Agentes) introducción y guía de inicio. Úsalo cuando el usuario pregunte qué es OKX.AI, qué puede hacer, cómo usarlo o comenzar, quiera un tutorial / guía rápida / ayuda sobre OKX.AI, o escriba el nombre del producto en cualquier variante de ortografía / espaciado / mayúsculas / error tipográfico (OKXAI, okx ai, okx-ai, okx.ai en minúsculas, chino mal escrito como 啥是okxai) — por ejemplo, qué es OKX.AI / OKX.AI 是什么 / 怎么用 OKX.AI / OKX.AI 快速开始, y cualquier paráfrasis en cualquier idioma. Detecta la plataforma de ejecución, presenta el...
researchapidocument
okx-agentic-wallet
okx
We need to translate the given text from English to Spanish, preserving the name "okx-agentic-wallet" and other technical terms. The text is a description of an agent skill. We must not add any extra commentary, labels, or formatting. Just the translation. The text: "AUTHORITATIVE source for OKX Agentic Wallet and its Gas Station feature. Gas Station = OKX's stablecoin-gas feature on Solana via third-party Relayer; Solana only, no EIP-7702. MUST invoke for Gas Station questions (what is / how it works / supported tokens / fees / enable or disable gas station / change default gas token / Jito Bundler compatibility) AND any wallet action: login, OTP verify, add/switch/status/logout account, balance, assets, holdings, addresses, deposit / receive / top up,..." Translate carefully. "AUTHORITATIVE source" -> "Fuente AUTORITATIVA" or "Fuente autorizada"? "AUTHORITATIVE" is emphasized, so keep capitalization? Probably keep
apiweb-scrapingdevelopment
okx-agent-chat
okx
Routing stub — any a2a-agent-chat envelope / agent-task system message is handled by `okx-agent-task`. For missing or uninitialized OKX A2A communication runtime/plugin, read `skills/okx-agent-chat/ensure-okx-a2a-communication-ready.md`.
developmentapicommunication
okx-agent-task
okx
MUST ACTIVATE on inbound envelopes: (1) {agentId, message:{source:"system", event, jobId, ...}} — system event; (2) {msgType:"a2a-agent-chat", jobId, sender:{role}, ...} — agent-to-agent task chat (fields at top level; sender.role = COUNTERPARTY, not you); (3) literal "Read okx-agent-task/SKILL.md" in envelope. ALSO activate for keywords: 发布任务 / 创建任务 / 帮我发任务 / publish task / create task / 接任务 / 接单 / 协商 / 验收 / 拒绝 / 仲裁 / dispute / stake / unstake / 修改卖家 / 修改预算 / change provider / change budget...
developmentapicommunication
okx-agent-payments-protocol
okx
Use when an agent hits HTTP 402 / payment-required, or the user mentions x402, x402Version, X-PAYMENT, PAYMENT-REQUIRED, PAYMENT-SIGNATURE, WWW-Authenticate: Payment, permit2, upto, metered billing, a payment channel / voucher / session, channelId / channel_id, opening / closing / topping up / settling / refunding a channel, a paymentId or a2a_ link, creating / checking a payment link, A2MCP / an A2MCP endpoint, or sending a request to / calling an Agent's endpoint with a concrete endpoint...
okx-security
okx
Usa esta skill para escaneo de seguridad: verificar seguridad de transacciones, ¿es segura esta transacción?, verificación previa a ejecución, escaneo de seguridad, escaneo de riesgo de tokens, detección de honeypot, detección de phishing en DApp/URL, seguridad de firma de mensajes, detección de transacciones maliciosas, verificaciones de seguridad de aprobaciones, gestión de aprobaciones de tokens. Disparadores: '¿es seguro este token?', 'verificar seguridad del token', 'verificar honeypot', 'escanear esta tx', 'escanear esta tx de swap', 'verificar riesgo de tx', '¿es esta URL una estafa?', 'verificar si esta dapp es segura', 'phishing...
okx-task-watch
okx
We need to translate the given text from English to Spanish, preserving the name "okx-task-watch" and other technical terms. The text includes a mix of Chinese and English phrases, but the target language is Spanish. The instruction says to translate only the text inside <text>. Do not include the name unless it appears in the source text. The name "okx-task-watch" is not inside the <text>? Actually the <text> contains "okx-task-watch" as part of the content? Let's check: The <text> starts with "监听任务进展 / 帮我盯着任务 / ..." and later includes "okx-task-watch" as part of the description? Wait, the instruction says "Name to preserve: okx-task-watch" but the text inside <text> does not contain that exact string? Let's read carefully: The text inside <text> is: "监听任务进展 / 帮我盯着任务 / 任务有动静告诉我 / 历史消息 / 未读消息 / 未决策 / 待决策 /
developmentapiproductivity