Skip to main content
ClaudeWave
Skill12k estrellas del repoactualizado today

defi-yield

This Claude Code skill analyzes and compares yields across DeFi protocols including lending, liquidity provision, staking, and yield farming to identify risk-adjusted opportunities and assess protocol sustainability. Use it to evaluate lending rates as market sentiment indicators, compare APY across sources like AMM fees and staking rewards, and evaluate the real-time demand for leverage and capital allocation patterns across DeFi ecosystems.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/HKUDS/Vibe-Trading /tmp/defi-yield && cp -r /tmp/defi-yield/agent/src/skills/defi-yield ~/.claude/skills/defi-yield
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# DeFi Yield Analysis & Optimization

## Overview

Analyze and compare yields across DeFi protocols — lending, liquidity provision, staking, and yield farming — to identify the best risk-adjusted opportunities and assess sustainability. DeFi yields are a real-time proxy for crypto market leverage demand, capital allocation, and protocol health.

## Core Concepts

### 1. DeFi Yield Sources

| Yield Source | Mechanism | Typical APY Range | Risk Level |
|-------------|-----------|-------------------|------------|
| Lending (supply) | Earn interest from borrowers | 1-15% (stablecoins 3-8%) | Low-medium |
| Borrowing cost | Interest paid by borrowers | 3-20% | N/A (cost side) |
| LP fees (AMM) | Trading fee share from DEX | 5-50% (varies by pair) | Medium-high |
| Staking | Validator/delegation rewards | 3-15% | Low-medium |
| Liquidity mining | Protocol token incentives | 10-500% (unsustainable) | High |
| Restaking | Re-hypothecated staking yield | 5-20% (ETH + AVS rewards) | Medium-high |
| Points farming | Off-chain points → future airdrop | Unknown (speculative) | Very high |

### 2. Lending Rate Analysis

**Lending rates as market signal:**

```python
# High borrow rates = high leverage demand = bullish sentiment
# Low borrow rates = low leverage demand = bearish / waiting

def lending_rate_signal(borrow_rate_stable, borrow_rate_eth):
    """Analyze DeFi lending rates for market sentiment."""
    if borrow_rate_stable > 15:
        stable_signal = "extreme_demand"    # Leveraged long via stablecoin borrowing
    elif borrow_rate_stable > 8:
        stable_signal = "elevated_demand"
    elif borrow_rate_stable > 3:
        stable_signal = "normal"
    else:
        stable_signal = "low_demand"        # Bear market, no one borrowing

    if borrow_rate_eth > 10:
        eth_signal = "extreme_demand"       # Shorting or leveraged strategies
    elif borrow_rate_eth > 5:
        eth_signal = "elevated"
    else:
        eth_signal = "low_demand"

    return stable_signal, eth_signal
```

**Key lending protocols:**

| Protocol | Chain | Specialization | TVL Range |
|----------|-------|---------------|-----------|
| Aave V3 | Multi-chain | Blue-chip lending, institutional grade | $10-20B |
| Compound V3 | Ethereum, Base | Conservative, USDC-focused | $3-5B |
| MakerDAO/Sky | Ethereum | CDP-based DAI/USDS minting | $8-15B |
| Morpho | Ethereum | Rate optimization, P2P matching | $3-8B |
| Spark | Ethereum | MakerDAO lending arm | $2-5B |
| Kamino | Solana | Concentrated LP + lending | $1-3B |

### 3. LP Yield Analysis

**Impermanent Loss (IL) — the core risk of LP positions:**

```python
def impermanent_loss(price_ratio_change):
    """
    Calculate impermanent loss for a 50/50 AMM pool.
    price_ratio_change: new_price / old_price of the volatile asset.
    """
    r = price_ratio_change
    il = 2 * (r ** 0.5) / (1 + r) - 1
    return il * 100  # Return as percentage

# Examples:
# Price +25% → IL = -0.6%
# Price +50% → IL = -2.0%
# Price +100% (2x) → IL = -5.7%
# Price +200% (3x) → IL = -13.4%
# Price -50% → IL = -5.7%
# Price -75% → IL = -20.0%
```

**LP yield = fee income + token incentives - impermanent loss**

```python
def net_lp_yield(fee_apy, incentive_apy, estimated_il_annualized):
    """Calculate risk-adjusted LP yield."""
    gross_yield = fee_apy + incentive_apy
    net_yield = gross_yield - abs(estimated_il_annualized)
    return net_yield

# Example: ETH/USDC pool
# Fee APY: 15%, Incentive APY: 20%, Estimated IL: 8%
# Net yield: 15% + 20% - 8% = 27%
```

**LP pool evaluation criteria:**

| Metric | Good | Mediocre | Avoid |
|--------|------|----------|-------|
| Fee APY / TVL | > 10% | 5-10% | < 5% |
| IL risk (based on pair volatility) | < 5% annualized | 5-15% | > 15% |
| TVL stability (30d change) | Growing or stable | Declining < 10% | Declining > 30% |
| Volume/TVL ratio | > 0.5x daily | 0.1-0.5x | < 0.1x |
| Incentive dependency | < 30% of yield | 30-70% | > 70% (unsustainable) |

### 4. Staking Yield Analysis

**ETH staking ecosystem:**

| Method | APY | Risk | Liquidity |
|--------|-----|------|-----------|
| Solo validator | ~3.5% | Slashing, downtime | Locked (exit queue) |
| Lido (stETH) | ~3.3% | Smart contract, governance | Liquid (stETH tradeable) |
| Rocket Pool (rETH) | ~3.2% | Smart contract, more decentralized | Liquid |
| Coinbase (cbETH) | ~3.0% | Custodial, regulatory | Liquid |
| EigenLayer restaking | ~3.5% + AVS rewards | Smart contract, slashing risk | Semi-liquid |

**Staking yield signal:**
```python
# ETH staking yield trends
# Rising yield = more transactions / MEV = network activity increasing (bullish)
# Falling yield = less activity = network cooling down

# Restaking yield premium
restaking_premium = eigenlayer_yield - native_staking_yield
if restaking_premium > 3:
    signal = "high_restaking_demand"     # AVS demand strong
elif restaking_premium > 1:
    signal = "moderate_premium"
else:
    signal = "low_premium"               # Restaking risk not compensated
```

### 5. Yield Sustainability Assessment

**The "real yield" test:**

```python
def yield_sustainability(protocol):
    """
    Real yield = yield funded by actual economic activity (fees, revenue)
    Token yield = yield funded by token emissions (inflationary, unsustainable)
    """
    total_yield_usd = protocol.total_yield_distributed_per_year
    fee_revenue_usd = protocol.annual_fee_revenue
    token_emission_usd = protocol.annual_token_emissions_at_market_price

    real_yield_pct = fee_revenue_usd / total_yield_usd * 100
    token_yield_pct = token_emission_usd / total_yield_usd * 100

    if real_yield_pct > 80:
        sustainability = "highly_sustainable"   # Revenue-funded
    elif real_yield_pct > 50:
        sustainability = "partially_sustainable"
    elif real_yield_pct > 20:
        sustainability = "emission_dependent"    # Mostly token incentives
    else:
        sustainability = "ponzi_risk"            # Almost entirely token-funded

    return sustainability,
vibe-tradingSkill

Professional finance research toolkit — backtesting (7 engines + benchmark comparison panel), factor analysis, Alpha Zoo (452 pre-built alphas across qlib158/alpha101/gtja191/academic), options pricing, 77 finance skills, 29 multi-agent swarm teams, Trade Journal analyzer, and Shadow Account (extract → backtest → render) across 7 data sources (tushare, yfinance, okx, akshare, mootdx, ccxt, futu).

adr-hshareSkill

ADR/H-share/A-share cross-listing premium analysis — track pricing gaps between US-listed ADRs, HK-listed H-shares, and A-shares for arbitrage signals, dual-listing valuation, and delisting risk assessment.

akshareSkill

AKShare financial data aggregator (18k+ stars). Free, no API key. Covers A-shares, US, HK, futures, macro, forex. Primary fallback for tushare and yfinance.

alpha-zooSkill

Browse and bench the bundled alpha zoos — prebuilt cross-sectional factor libraries (Kakushadze 101, GTJA 191, Qlib 158, Fama-French / Carhart). Use when the user asks "which alphas exist", wants metadata on a named alpha, or wants to run IC/IR on a whole zoo over a universe.

ashare-pre-st-filterSkill

A 股 ST/*ST 风险预测框架 — 基于最新中报/三季报或业绩预告/快报,预测下一财年是否会因营收、利润、净资产、分红不达标而被风险警示,并将新浪监管处罚记录作为独立证据面纳入风险等级。仅适用于 A 股,不预测财务造假。

asset-allocationSkill

Asset allocation theory and optimizer usage — MPT / Black-Litterman / risk budgeting / all-weather strategy, including guides for 4 optimizers and rebalancing rules.

backtest-diagnoseSkill

Diagnose failed or underperforming backtests, locate the root cause, and fix the issue

behavioral-financeSkill

Behavioral finance applications: theories of overreaction and underreaction, behavioral explanations for momentum and reversal, investor sentiment cycles, cognitive-bias checklists, and debiasing quantitative strategies.