pubfi-wallet-portfolio-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Wallet Portfolio Analysis

钱包组合分析

Goal: Provide concise asset distribution analysis and risk assessment for EVM wallets.
目标:为EVM钱包提供简洁的资产分布分析和风险评估。

Inputs

输入项

  • wallet_address
    (required): EVM address (0x...)
  • wallet_address
    (必填):EVM地址(0x...)

Data Source

数据源

Primary: Zerion API via
zerion-portfolio.py
bash
undefined
主要来源:通过
zerion-portfolio.py
调用Zerion API
bash
undefined

Get all assets

Get all assets

python3 zerion-portfolio.py <address>
python3 zerion-portfolio.py <address>

Get only DeFi positions

Get only DeFi positions

python3 zerion-portfolio.py <address> --only-defi

**Environment**: `ZERION_API_KEY` must be set. If not set, get your API key at: https://www.zerion.io/api
python3 zerion-portfolio.py <address> --only-defi

**环境要求**:必须设置`ZERION_API_KEY`。如果未设置,请访问https://www.zerion.io/api获取API密钥。

Execution Workflow

执行流程

Step 1: Validate Input

步骤1:验证输入

yaml
1. Check address format: 0x + 40 hex characters
2. If invalid format: Exit with error message
yaml
1. Check address format: 0x + 40 hex characters
2. If invalid format: Exit with error message

Step 2: Fetch Portfolio Data

步骤2:获取组合数据

bash
undefined
bash
undefined

Execute Zerion portfolio script

Execute Zerion portfolio script

python3 skills/pubfi-wallet-portfolio-analysis/zerion-portfolio.py <address>

**Handle Edge Cases:**
- Empty wallet → Report "Empty wallet"
- API failure → Exit with error, cannot proceed
- Zero-value positions → Skip
python3 skills/pubfi-wallet-portfolio-analysis/zerion-portfolio.py <address>

**边缘情况处理:**
- 空钱包 → 报告"空钱包"
- API调用失败 → 报错退出,无法继续执行
- 零价值持仓 → 跳过

Step 3: Categorize Assets

步骤3:分类资产

yaml
Group by type:
  Native: ETH, MATIC, BNB, etc.
  Stablecoins: USDC, USDT, DAI, USDS
  DeFi Positions: Has protocol attribute + position_type != 'wallet'
  Other Tokens: Everything else

Track total value per category for distribution percentages
yaml
Group by type:
  Native: ETH, MATIC, BNB, etc.
  Stablecoins: USDC, USDT, DAI, USDS
  DeFi Positions: Has protocol attribute + position_type != 'wallet'
  Other Tokens: Everything else

Track total value per category for distribution percentages

Step 4: Identify DeFi Protocols

步骤4:识别DeFi协议

yaml
For each DeFi position:
  1. Extract protocol name from attributes.protocol
  2. Identify position type (Lending/Staking/LP/etc.)
  3. Record position value and percentage of portfolio
  4. Create list of unique protocols for risk assessment
yaml
For each DeFi position:
  1. Extract protocol name from attributes.protocol
  2. Identify position type (Lending/Staking/LP/etc.)
  3. Record position value and percentage of portfolio
  4. Create list of unique protocols for risk assessment

Step 5: Risk Assessment (DeFi Protocols Only)

步骤5:风险评估(仅针对DeFi协议)

yaml
For each identified protocol:
  
  A. Fetch Protocol Data (parallel):
     - DefiLlama API: curl "https://api.llama.fi/protocol/{slug}"
     - Extract TVL, chains, audit info, category
  
  B. Check Recent Exploits:
     - Search rekt.news for protocol name
     - Filter last 90 days
     - Record any incidents
  
  C. Calculate Risk Score:
     Risk = Base + Events + Audit + TVL Trend
     
     Factors:
     - No audit: +5
     - Recent exploit (90 days): +5
     - TVL drop >50% (30 days): +3
     - TVL drop 20-50%: +2
     - New protocol (<6 months): +2
     - Single audit: +1
     - Multiple audits: -2
     - Battle-tested (>1 year): -1
  
  D. Assign Risk Level:
     - Score > 7: 🔴 High Risk
     - Score 4-7: 🟡 Medium Risk
     - Score < 4: 🟢 Low Risk
  
  E. Error Handling:
     - DefiLlama fails: Mark TVL as "N/A", continue
     - Rekt.news unavailable: Mark exploits as "Unknown"

Known Safe Protocols (auto 🟢):
  - Aave V2/V3, Uniswap V2/V3, Compound V2/V3
  - Lido, Curve, MakerDAO/Sky
yaml
For each identified protocol:
  
  A. Fetch Protocol Data (parallel):
     - DefiLlama API: curl "https://api.llama.fi/protocol/{slug}"
     - Extract TVL, chains, audit info, category
  
  B. Check Recent Exploits:
     - Search rekt.news for protocol name
     - Filter last 90 days
     - Record any incidents
  
  C. Calculate Risk Score:
     Risk = Base + Events + Audit + TVL Trend
     
     Factors:
     - No audit: +5
     - Recent exploit (90 days): +5
     - TVL drop >50% (30 days): +3
     - TVL drop 20-50%: +2
     - New protocol (<6 months): +2
     - Single audit: +1
     - Multiple audits: -2
     - Battle-tested (>1 year): -1
  
  D. Assign Risk Level:
     - Score > 7: 🔴 High Risk
     - Score 4-7: 🟡 Medium Risk
     - Score < 4: 🟢 Low Risk
  
  E. Error Handling:
     - DefiLlama fails: Mark TVL as "N/A", continue
     - Rekt.news unavailable: Mark exploits as "Unknown"

Known Safe Protocols (auto 🟢):
  - Aave V2/V3, Uniswap V2/V3, Compound V2/V3
  - Lido, Curve, MakerDAO/Sky

Step 6: Generate Report

步骤6:生成报告

Output structured markdown report following the Output Format section below.

按照以下输出格式生成结构化Markdown报告。

Output Format

输出格式

1) Summary

1) 摘要

Portfolio: 0x...
Total Value: $X,XXX USD
Chains: Ethereum, Arbitrum, Base
Portfolio: 0x...
Total Value: $X,XXX USD
Chains: Ethereum, Arbitrum, Base

2) Asset Distribution

2) 资产分布

Asset Breakdown:
• Native: $XXX (XX%)
• Stablecoins: $XXX (XX%)
• DeFi Positions: $XXX (XX%)
• Other Tokens: $XXX (XX%)
Asset Breakdown:
• Native: $XXX (XX%)
• Stablecoins: $XXX (XX%)
• DeFi Positions: $XXX (XX%)
• Other Tokens: $XXX (XX%)

3) Top Positions

3) 主要持仓

Table format showing all positions sorted by value:
Protocol/Wallet | Position Type | Value | % Portfolio
----------------|---------------|-------|------------
Wallet Assets   | Wallet        | $XXX  | XX%
Protocol A      | Lending       | $XXX  | XX%
Protocol B      | LP            | $XXX  | XX%
以下为按价值排序的所有持仓表格:
Protocol/Wallet | Position Type | Value | % Portfolio
----------------|---------------|-------|------------
Wallet Assets   | Wallet        | $XXX  | XX%
Protocol A      | Lending       | $XXX  | XX%
Protocol B      | LP            | $XXX  | XX%

4) Top Holdings (>2% of portfolio)

4) 核心持仓(占组合比例>2%)

Table format:
Chain | Asset | Type | Amount | Value | % Portfolio
------|-------|------|--------|-------|------------
表格格式:
Chain | Asset | Type | Amount | Value | % Portfolio
------|-------|------|--------|-------|------------

5) DeFi Exposure

5) DeFi协议暴露情况

For each protocol with 🟡 Medium or 🔴 High risk only (skip 🟢 Low risk):
Protocol Name (Chain)
• Position Value: $XXX (XX% of portfolio)
• Position Type: Lending/Staking/LP/etc.
• Risk: 🟡/🔴
• TVL: $XXX (DefiLlama)
• Audit: Yes/No (auditor names)
• Recent Issues: None / [describe]
If all protocols are low risk, output: "All DeFi positions are in low-risk protocols (🟢)"
仅针对标记为🟡中等风险或🔴高风险的协议(跳过🟢低风险协议):
Protocol Name (Chain)
• Position Value: $XXX (XX% of portfolio)
• Position Type: Lending/Staking/LP/etc.
• Risk: 🟡/🔴
• TVL: $XXX (DefiLlama)
• Audit: Yes/No (auditor names)
• Recent Issues: None / [describe]
若所有协议均为低风险,输出:"所有DeFi持仓均处于低风险协议中(🟢)"

6) Risk Summary

6) 风险摘要

High Priority:
  • List any 🔴 high-risk positions with recommended actions
Medium Priority:
  • List any 🟡 medium-risk positions with considerations
Overall Assessment:
  • One paragraph summary
  • Risk score: Low/Medium/High
高优先级:
  • 列出所有🔴高风险持仓并给出建议操作
中优先级:
  • 列出所有🟡中等风险持仓并给出注意事项
整体评估:
  • 一段式总结
  • 风险等级:低/中/高

7) Data Sources

7) 数据源

  • Zerion API: Portfolio data (timestamp)
  • DefiLlama: Protocol TVL and info
  • Rekt.news: Security incidents
  • [Other sources used]

  • Zerion API:组合数据(带时间戳)
  • DefiLlama:协议TVL及相关信息
  • Rekt.news:安全事件
  • [使用的其他数据源]

Quality Standards

质量标准

Conciseness:
  • Total report: 200-400 words (excluding tables)
  • Focus on actionable insights only
  • No filler or generic statements
Accuracy:
  • All data must have timestamps
  • All values must come from real API calls
  • Risk assessments must cite specific evidence
Usefulness:
  • Highlight positions >5% of portfolio
  • Flag any high-risk exposure immediately
  • Provide clear next actions if needed

简洁性:
  • 报告总字数:200-400字(不含表格)
  • 仅聚焦可落地的洞察
  • 无冗余或通用表述
准确性:
  • 所有数据必须带有时间戳
  • 所有数值必须来自真实API调用
  • 风险评估必须引用具体依据
实用性:
  • 突出占组合比例>5%的持仓
  • 立即标记所有高风险暴露情况
  • 必要时提供明确的后续操作建议

Update Frequency

更新频率

  • Risk database: Update monthly with rekt.news
  • Known protocols: Update as new major protocols launch
  • Audit status: Verify quarterly
Last updated: 2026-02-05
  • 风险数据库:每月通过rekt.news更新
  • 已知协议列表:随新主流协议上线更新
  • 审计状态:每季度验证一次
最后更新时间:2026-02-05