PluginBench
Skill
Pass
Audit score 90

okx-defi-portfolio

okx/onchainos-skills

View DeFi positions and holdings across protocols and chains.

What is okx-defi-portfolio?

Check your DeFi portfolio, staking, and lending positions across multiple protocols and blockchains. Use this when you want an overview of your DeFi holdings or detailed position information for a specific protocol—not for deposit/redeem/claim operations or wallet token balances.

  • Query DeFi holdings overview across supported chains (Ethereum, BSC, Polygon, Arbitrum, Base, Solana, and 9+ others)
  • View detailed position information for a specific protocol including token amounts, USD values, and pending rewards
  • Resolve wallet addresses automatically from the Agentic Wallet if not explicitly provided
  • Display V3 pool positions with range, tick, and tokenId information for liquidity management
  • Map investment types (Supply, Borrow, Stake, Farm, Pool, Vaults) and show health rates for borrowed positions

How to install okx-defi-portfolio

npx skills add https://github.com/okx/onchainos-skills --skill okx-defi-portfolio
Prerequisites
  • OKX Agentic Wallet installed and logged in (or provide wallet address manually)
  • Supported chain: Ethereum, BSC, Polygon, Arbitrum, Base, X Layer, Avalanche, Optimism, Fantom, Sui, Tron, TON, Linea, Scroll, zkSync, or Solana
Claude Code
Cursor
Windsurf
Cline

How to use okx-defi-portfolio

  1. 1.Resolve your wallet address by running `onchainos wallet status` and `onchainos wallet addresses` if not logged in, or provide an explicit address
  2. 2.Run `onchainos defi positions --address <addr> --chains <chains>` to get an overview of holdings across protocols
  3. 3.Copy the `analysisPlatformId` from the results table for any protocol you want to inspect further
  4. 4.Run `onchainos defi position-detail --address <addr> --chain <chain> --platform-id <id>` to view detailed token breakdown, amounts, values, and pending rewards for that protocol
  5. 5.Review health rates for borrowed positions; if health rate < 1.5, consider reducing borrow or adding collateral

Use cases

Good for
  • Check your total DeFi portfolio value across all protocols and chains at a glance
  • View detailed holdings for a specific protocol like Aave or Curve to understand your position breakdown
  • Monitor staking and lending positions to track rewards and health ratios
  • Identify which protocols and chains hold your assets before executing deposit, redeem, or claim operations
  • Review V3 liquidity pool positions including range and tick information for rebalancing decisions
Who it's for
  • DeFi investors managing positions across multiple protocols
  • Users tracking staking and lending exposure
  • Portfolio managers monitoring multi-chain holdings
  • Anyone needing a consolidated view of DeFi positions before executing transactions

okx-defi-portfolio FAQ

What's the difference between this skill and okx-agentic-wallet?

okx-agentic-wallet shows your wallet token balances and handles swaps. This skill shows your DeFi positions (deposits, borrows, stakes, pools) across protocols. Use this for DeFi portfolio overview; use okx-agentic-wallet for raw token balances.

When should I use okx-defi-invest instead?

Use okx-defi-invest when you want to deposit, redeem, claim rewards, or execute transactions. Use this skill to view and analyze your positions first.

What if I want to check positions on a specific DApp like Aave or Hyperliquid?

If you name a specific third-party DApp, route to okx-dapp-discovery instead, which loads that DApp's native plugin for protocol-specific position views.

How do I use the analysisPlatformId and investmentId from the results?

Copy `analysisPlatformId` from the positions table to run `position-detail` for that protocol. Copy `investmentId` from the detail table if you need to redeem or claim via okx-defi-invest.

Which chains are supported?

Ethereum, BSC, Polygon, Arbitrum, Base, X Layer, Avalanche, Optimism, Fantom, Sui, Tron, TON, Linea, Scroll, zkSync, and Solana.

Full instructions (SKILL.md)

Source of truth, from okx/onchainos-skills.


name: okx-defi-portfolio description: "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 okx-defi-invest. Do NOT use for wallet token balances — use okx-agentic-wallet. Do NOT use for DEX spot swaps — use okx-agentic-wallet. Do NOT use when the user names a specific third-party DApp by name (e.g. 'show my Aave positions', 'my Hyperliquid balance', 'check my Polymarket holdings') — route to okx-dapp-discovery instead, which loads the DApp's plugin for protocol-native position views." license: MIT metadata: author: okx version: "4.1.0" homepage: "https://web3.okx.com"

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-agentic-wallet
  • For DEX spot swap → use okx-agentic-wallet

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.000012–––Platform 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 (ethereum → 1, bsc → 56, solana → 501)