Okx Defi Portfolio
by @ok-james-01
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...
clawhub install okx-defi-portfolioπ About This Skill
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-wallet-portfolio. Do NOT use for DEX spot swaps β use okx-dex-swap. 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: "2.6.0" homepage: "https://web3.okx.com"
OKX DeFi Portfolio
2 commands for viewing DeFi positions and holdings across protocols and chains.
Skill Routing
okx-defi-investokx-dex-marketokx-wallet-portfoliookx-dex-swapQuickstart
# Get DeFi holdings overview across chains
onchainos defi positions \
--address 0xYourWallet \
--chains ethereum,bsc,solanaGet detailed holdings for a specific protocol (analysisPlatformId from positions output)
onchainos defi position-detail \
--address 0xYourWallet \
--chain ethereum \
--platform-id 67890
Command Index
| # | Command | Description |
|---|---------|-------------|
| 1 | onchainos defi support-chains | Get supported chains for DeFi |
| 2 | onchainos defi support-platforms | Get supported platforms for DeFi |
| 3 | onchainos defi positions --address | Get user DeFi holdings overview |
| 4 | onchainos defi position-detail --address | Get detailed holdings for a protocol |
Chain Support
| Chain | Name / Aliases | chainIndex |
|-------|----------------|-----------|
| Ethereum | ethereum, eth | 1 |
| BSC | bsc, bnb | 56 |
| Polygon | polygon, matic | 137 |
| Arbitrum | arbitrum, arb | 42161 |
| Base | base | 8453 |
| X Layer | xlayer, okb | 196 |
| Avalanche | avalanche, avax | 43114 |
| Optimism | optimism, op | 10 |
| Fantom | fantom, ftm | 250 |
| Sui | sui | 784 |
| Tron | tron, trx | 195 |
| TON | ton | 607 |
| Linea | linea | 59144 |
| Scroll | scroll | 534352 |
| zkSync | zksync | 324 |
| Solana | solana, sol | 501 |
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:
okx-agentic-wallet) or provide an address manuallywallet balance --all to get all account IDs, then wallet switch + wallet addresses for each account, and query positions for eachStep 1: Identify Intent
| User says | Action |
|-----------|--------|
| View positions / portfolio / holdings | onchainos defi positions |
| View detail for a protocol | onchainos defi position-detail |
| Redeem / claim after viewing | Suggest β use okx-defi-invest |
Step 2: Collect Parameters
defi positions first to get analysisPlatformIdStep 3: Display Results
#### Displaying Positions Results
When displaying defi positions output, you MUST use exactly these columns in this order β no substitutions, no omissions:
| # | Platform | analysisPlatformId | Chains | Positions | Value(USD) | |---|---------|--------------------|----|--------|-----------| | 1 | Aave V3 | 12345 | ETH,BSC | 2 | $120.00 |
Rules:
analysisPlatformId is MANDATORY in every row β users must copy this value to run position-detailanalysisPlatformId with any other fieldwalletIdPlatformList[*].platformList[*] β each element is one platform rowplatformName β 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:
| Type | Asset | Amount | Value(USD) | investmentId | aggregateProductId | Token Contract | Rewards | |------|------|------|-----------|--------------|--------------------|-----------|------| | Supply | USDT | 1.002285 | $1.0025 | 127 | 71931 | 0x970223...7 | 0.000080 AVAX | | Pending | sAVAX | 0.00000091 | $0.000012 | β | β | β | Platform reward |
Rules:
investmentId and aggregateProductId from its parent investment entryinvestmentId is MANDATORY in every row β users need it for redeem/claim (via okx-defi-invest)aggregateProductId β show if present, otherwise ββ if native/emptyβ if none; for platform rewards show Platform rewardPendinghealthRate < 1.5#### V3 Pool Positions β Extra Fields
For V3 Pool positions (positionList present), show an additional section per position:
| tokenId | Status | Range | tickLower | tickUpper | |---------|--------|-------|-----------|-----------| | 93828 | ACTIVE | 0.892 β 0.992 USDC/DAI | -33500 | -30450 |
tokenId: from positionList[].tokenIdpositionStatus: ACTIVE or INACTIVErange: from positionList[].rangetickLower / tickUpper: from positionList[].rangeInfo.tickLower / rangeInfo.tickUpperinvestType Reference
| investType | Description | |------------|-------------| | 1 | Save (savings/yield) | | 2 | Pool (liquidity pool) | | 3 | Farm (yield farming) | | 4 | Vaults | | 5 | Stake | | 6 | Borrow | | 7 | Staking | | 8 | Locked | | 9 | Deposit | | 10 | Vesting |
Post-execution Suggestions
| Just completed | Suggest |
|----------------|---------|
| defi positions | 1. View detail β defi position-detail 2. Redeem β okx-defi-invest 3. Claim rewards β okx-defi-invest |
| defi position-detail | 1. 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 (via okx-defi-invest) 2. View price history β defi depth-price-chart --investment-id |
Global Notes
--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 --chaindefi position-detail uses --chain (singular) β do NOT use --chains--address for both commandsposition-detail requires analysisPlatformId from positions output as --platform-idethereum β 1, bsc β 56, solana β 501)