
Market Data
okx-wallet-portfolio
OKX Wallet Portfolio CLI is a command-line Skill that provides four commands to query supported chains for wallet total value, all token balances, and specific token balances across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ other chains.
Overview
OKX Wallet Portfolio CLI is a command-line Skill that provides four commands to query supported chains for wallet total value, all token balances, and specific token balances across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ other chains.
OKX Wallet Portfolio CLI is a command-line Skill that provides four commands to query supported chains for wallet total value, all token balances, and specific token balances across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ other chains. It enforces pre-flight checks: verify onchainos is installed (with an installer fallback), check for updates every 12 hours, attempt reinstall on unexpected failures, and allow optional .env overrides for OKX API credentials. Use it to get quick multi-chain portfolio snapshots, per-token holdings, aggregated USD valuation, or to audit and report DeFi positions and remaining funds. Specific integrations route price/K-line queries to okx-dex-market, token metadata to okx-dex-token, and swap execution to okx-dex-swap, improving accuracy and operational reliability.
Skill.md
How this skill works
OKX Wallet Portfolio CLI is a command-line Skill that provides four commands to query supported chains for wallet total value, all token balances, and specific token balances across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ other chains.
OKX Wallet Portfolio CLI
4 commands for supported chains, wallet total value, all token balances, and specific token balances.
Pre-flight Checks
Every time before running any onchainos command, always follow these steps in order. Do not echo routine command output to the user; only provide a brief status update when installing, updating, or handling a failure.
-
Confirm installed: Run
which onchainos. If not found, install it:curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | shIf the install script fails, ask the user to install manually following the instructions at: https://github.com/okx/onchainos-skills
-
Check for updates: Read
~/.onchainos/last_checkand compare it with the current timestamp:cached_ts=$(cat ~/.onchainos/last_check 2>/dev/null || true) now=$(date +%s)- If
cached_tsis non-empty and(now - cached_ts) < 43200(12 hours), skip the update and proceed. - Otherwise (file missing or older than 12 hours), run the installer to check for updates:
If a newer version is installed, tell the user and suggest updating their onchainos skills from https://github.com/okx/onchainos-skills to get the latest features.curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
- If
-
If any
onchainoscommand fails with an unexpected error during this session, try reinstalling before giving up:curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh -
Create a
.envfile in the project root to override the default API credentials (optional — skip this for quick start):OKX_API_KEY= # or OKX_ACCESS_KEY OKX_SECRET_KEY= OKX_PASSPHRASE=
Skill Routing
- For token prices / K-lines → use
okx-dex-market - For token search / metadata → use
okx-dex-token - For swap execution → use
okx-dex-swap - For transaction broadcasting → use
okx-onchain-gateway
Quickstart
# Get supported chains for balance queries
onchainos portfolio chains
# Get total asset value on XLayer and Solana
onchainos portfolio total-value --address 0xYourWallet --chains "xlayer,solana"
# Get all token balances
onchainos portfolio all-balances --address 0xYourWallet --chains "xlayer,solana,ethereum"
# Check specific tokens (native OKB + USDC on XLayer)
onchainos portfolio token-balances --address 0xYourWallet --tokens "196:,196:0x74b7f16337b8972027f6196a17a631ac6de26d22"
Chain Name Support
The CLI accepts human-readable chain names and resolves them automatically.
| Chain | Name | chainIndex |
|---|---|---|
| XLayer | xlayer | 196 |
| Solana | solana | 501 |
| Ethereum | ethereum | 1 |
| Base | base | 8453 |
| BSC | bsc | 56 |
| Arbitrum | arbitrum | 42161 |
Address format note: EVM addresses (0x...) work across Ethereum/BSC/Polygon/Arbitrum/Base etc. Solana addresses (Base58) and Bitcoin addresses (UTXO) have different formats. Do NOT mix formats across chain types.
Command Index
| # | Command | Description |
|---|---|---|
| 1 | onchainos portfolio chains | Get supported chains for balance queries |
| 2 | onchainos portfolio total-value --address ... --chains ... | Get total asset value for a wallet |
| 3 | onchainos portfolio all-balances --address ... --chains ... | Get all token balances for a wallet |
| 4 | onchainos portfolio token-balances --address ... --tokens ... | Get specific token balances |
Cross-Skill Workflows
This skill is often used before swap (to verify sufficient balance) or as portfolio entry point.
Workflow A: Pre-Swap Balance Check
User: "Swap 1 SOL for BONK"
1. okx-dex-token onchainos token search BONK --chains solana → get tokenContractAddress
↓ tokenContractAddress
2. okx-wallet-portfolio onchainos portfolio all-balances --address <addr> --chains solana
→ verify SOL balance >= 1
↓ balance field (UI units) → convert to minimal units for swap
3. okx-dex-swap onchainos swap quote --from 11111111111111111111111111111111 --to <BONK_address> --amount 1000000000 --chain solana
4. okx-dex-swap onchainos swap swap --from ... --to <BONK_address> --amount 1000000000 --chain solana --wallet <addr>
Data handoff:
tokenContractAddressfrom token search → feeds into swap--from/--tobalancefrom portfolio is UI units; swap needs minimal units → multiply by10^decimal- If balance < required amount → inform user, do NOT proceed to swap
Workflow B: Portfolio Overview + Analysis
User: "Show my portfolio"
1. okx-wallet-portfolio onchainos portfolio total-value --address <addr> --chains "xlayer,solana,ethereum"
→ total USD value
2. okx-wallet-portfolio onchainos portfolio all-balances --address <addr> --chains "xlayer,solana,ethereum"
→ per-token breakdown
↓ top holdings by USD value
3. okx-dex-token onchainos token price-info <address> --chain <chain> → enrich with 24h change, market cap
4. okx-dex-market onchainos market kline <address> --chain <chain> → price charts for tokens of interest
Workflow C: Sell Underperforming Tokens
1. okx-wallet-portfolio onchainos portfolio all-balances --address <addr> --chains "xlayer,solana,ethereum"
→ list all holdings
↓ tokenContractAddress + chainIndex for each
2. okx-dex-token onchainos token price-info <address> --chain <chain> → get priceChange24H per token
3. Filter by negative change → user confirms which to sell
4. okx-dex-swap onchainos swap quote → onchainos swap swap → execute sell
Key conversion: balance (UI units) × 10^decimal = amount (minimal units) for swap.
Operation Flow
Step 1: Identify Intent
- Check total assets →
onchainos portfolio total-value - View all token holdings →
onchainos portfolio all-balances - Check specific token balance →
onchainos portfolio token-balances - Unsure which chains are supported →
onchainos portfolio chainsfirst
Step 2: Collect Parameters
- Missing wallet address → ask user
- Missing target chains → recommend XLayer (
--chains xlayer, low gas, fast confirmation) as the default, then ask which chain the user prefers. Common set:"xlayer,solana,ethereum,base,bsc" - Need to filter risky tokens → set
--exclude-risk 0(only works on ETH/BSC/SOL/BASE)
Step 3: Call and Display
- Total value: display USD amount
- Token balances: show token name, amount (UI units), USD value
- Sort by USD value descending
Step 4: Suggest Next Steps
After displaying results, suggest 2-3 relevant follow-up actions:
| Just completed | Suggest |
|---|---|
portfolio total-value | 1. View token-level breakdown → onchainos portfolio all-balances (this skill) 2. Check price trend for top holdings → okx-dex-market |
portfolio all-balances | 1. View detailed analytics (market cap, 24h change) for a token → okx-dex-token 2. Swap a token → okx-dex-swap 3. View price chart for a token → okx-dex-market |
portfolio token-balances | 1. View full portfolio across all tokens → onchainos portfolio all-balances (this skill) 2. Swap this token → okx-dex-swap |
Present conversationally, e.g.: "Would you like to see the price chart for your top holding, or swap any of these tokens?" — never expose skill names or endpoint paths to the user.
CLI Command Reference
1. onchainos portfolio chains
Get supported chains for balance queries. No parameters required.
onchainos portfolio chains
Return fields:
| Field | Type | Description |
|---|---|---|
name | String | Chain name (e.g., "XLayer") |
logoUrl | String | Chain logo URL |
shortName | String | Chain short name (e.g., "OKB") |
chainIndex | String | Chain unique identifier (e.g., "196") |
2. onchainos portfolio total-value
Best used for
When to use it
OKX Wallet Portfolio CLI is a command-line Skill that provides four commands to query supported chains for wallet total value, all token balances, and specific token balances across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon and 20+ other chains.

01 · PRE-MEETING
Prepare a decision brief
Turn scattered evidence into a structured case before an investment committee meeting.

02 · TEAM WORKFLOW
Standardize handoffs
Create consistent research outputs across analysts, portfolio managers, and agents.

03 · LIVE UPDATE
Refresh the thesis
Update scenarios after a new catalyst, KPI release, or earnings result.
Community notes
Built to improve with use.
随着 Skill 被使用与评审,反馈将展示在这里。
Discover more
Related skills
View allstrykr-prism
Strykr PRISM is a unified, real-time financial data API designed for AI agents, trading bots, and fintech applications. It provides canonical asset resolution (handles symbols, aliases, and…
gmgn-market
gmgn-market is a CLI-driven Skill for retrieving crypto and meme-token market data: K-line (candlestick/OHLCV) charts, trending token rankings by USD volume, Trenches token lists, and newly launched…
gmgn-portfolio
The gmgn-portfolio Skill uses the gmgn-cli to analyze crypto wallets on Solana, BSC, and Base, returning holdings, token balances, realized and unrealized P&L, portfolio statistics, trade history,…