DeFi yield evaluation including fee APR, real vs nominal yield, net APY after costs, and yield sustainability analysis
npx skills add https://github.com/agiprolabs/claude-trading-skills --skill yield-analysis
DeFi yields are often misleading. A pool advertising 200% APY may deliver negative real returns once you account for impermanent loss, gas costs, and emission token depreciation. This skill provides the framework to decompose, evaluate, and compare yield opportunities accurately.
Most DeFi yield dashboards show nominal yield — the headline number. Real yield requires decomposing that number into its components and subtracting all costs. Without this decomposition:
Every DeFi yield breaks down into one or more of these sources:
Swap fees earned by liquidity providers. This is the most sustainable yield source because it comes from real economic activity.
fee_apr = (daily_volume * fee_rate / tvl) * 365
your_daily_fees = daily_volume * fee_rate * (your_liquidity / total_liquidity)
For CLMM pools (concentrated liquidity), fee income is amplified by how tightly you concentrate your range. See the lp-math skill for CLMM mechanics.
Protocol reward tokens distributed to LPs. Often the largest component of advertised yields, but frequently unsustainable.
emission_apr = (daily_emission_tokens * token_price * 365) / tvl
The critical question: will the emission token hold its value? If everyone farms and dumps, the token depreciates and actual USD yield is much lower.
Interest earned from lending protocol deposits (Marginfi, Kamino, Solend). Driven by borrowing demand — more sustainable than emissions but fluctuates with utilization.
Validator staking yield (~7% APR on Solana) or liquid staking token (LST) yield. The baseline risk-free rate for the Solana ecosystem.
| Metric | What It Includes | What It Ignores |
|--------|-----------------|-----------------|
| Nominal APY | Fee APR + emission APR (compounded) | IL, gas, depreciation, risk |
| Real Yield | Everything, net of all costs | Nothing — this is the true return |
real_yield = fee_apr
+ emission_apr × (1 - emission_depreciation)
- il_cost
- gas_cost
- rebalancing_cost
Where:
fee_apr: annualized fee income as fraction of position valueemission_apr: annualized emission income at current token priceemission_depreciation: expected decline in emission token price (0.0 to 1.0)il_cost: expected impermanent loss as annualized rate (see impermanent-loss skill)gas_cost: transaction fees for deposits, withdrawals, claims, compoundsrebalancing_cost: for CLMM positions, cost of rebalancing out-of-range positionsNominal APY displayed: 45%
Decomposition:
Fee APR: 18%
Emission APR: 30% (RAY token rewards)
Emission depreciation: 40% (RAY down 40% over 30d)
Effective emission: 18% (30% × 0.6)
IL cost (estimated): 12% (SOL volatile against USDC)
Gas + rebalance: 1%
Real yield = 18% + 18% - 12% - 1% = 23%
The 45% nominal yield is really 23% after accounting for all factors.
fee_apr = fee_rate * daily_volume / tvl * 365
For a pool with 0.25% fee rate, $2M daily volume, and $10M TVL:
fee_apr = 0.0025 * 2_000_000 / 10_000_000 * 365 = 18.25%
CLMM fee income depends on your position range relative to trading activity:
# Simplified — see lp-math skill for full CLMM math
fee_apr = fee_rate * daily_volume_in_range / position_liquidity * 365
Tighter ranges earn higher fees per dollar deployed but go out of range more frequently, requiring rebalancing.
your_share = your_liquidity / total_pool_liquidity
your_daily_fees = total_daily_fees * your_share
# Protocol P/E ratio
pe_ratio = fully_diluted_valuation / annual_protocol_revenue
# Revenue-to-emission ratio (> 1.0 is sustainable)
sustainability = annual_revenue / annual_emission_value
# Token velocity (high = lots of sell pressure)
velocity = daily_emission_selling / daily_token_volume
Interpretation:
When comparing yield opportunities, normalize across these dimensions:
Compare like for like. For SOL:
| Strategy | Expected APR | Risk Level | IL Exposure |
|----------|-------------|------------|-------------|
| Native staking | ~7% | Low | None |
| Liquid staking (mSOL) | ~7.5% | Low | Minimal |
| SOL-USDC LP (Orca) | ~15-25% | Medium | High |
| SOL lending (Marginfi) | ~3-8% | Low-Med | None |
| Leveraged yield | ~20-50% | High | Varies |
risk_score = (
il_risk * 0.3 +
smart_contract_risk * 0.25 +
emission_sustainability_risk * 0.2 +
liquidity_risk * 0.15 +
protocol_risk * 0.1
)
risk_adjusted_yield = net_apr / risk_score
Include all costs:
impermanent-loss skill)| Protocol | Pool Types | Fee Tiers | Notes |
|----------|-----------|-----------|-------|
| Raydium | CPMM, CLMM | 0.01-1% | Largest Solana DEX by volume |
| Orca | CLMM (Whirlpool) | 0.01-2% | Concentrated liquidity focused |
| Meteora | DLMM, Dynamic | Variable | Dynamic fee adjustment |
| Protocol | Assets | Typical APR | Notes |
|----------|--------|-------------|-------|
| Marginfi | SOL, USDC, etc. | 2-10% | Points program active |
| Kamino | SOL, USDC, etc. | 2-12% | Auto-compound vaults |
| Solend | SOL, USDC, etc. | 1-8% | Established protocol |
| Method | APR | Lock Period | Notes |
|--------|-----|------------|-------|
| Native SOL staking | ~7% | 1 epoch (~2d) | Validator selection matters |
| mSOL (Marinade) | ~7.2% | Instant | Liquid, usable in DeFi |
| jitoSOL (Jito) | ~7.5% | Instant | Includes MEV rewards |
| bSOL (BlazeStake) | ~7% | Instant | Decentralized validator set |
import httpx
# All yield pools
pools = httpx.get("https://yields.llama.fi/pools").json()
# Filter for Solana
solana_pools = [p for p in pools["data"] if p["chain"] == "Solana"]
# Sort by TVL
solana_pools.sort(key=lambda p: p.get("tvlUsd", 0), reverse=True)
Response fields: pool, chain, project, symbol, tvlUsd, apy, apyBase, apyReward, il7d, exposure.
https://api-v3.raydium.io/pools/info/listhttps://api.mainnet.orca.so/v1/whirlpool/listlp-math: AMM formulas for fee calculation and position mathimpermanent-loss: IL estimation for real yield calculationdefillama-api: Fetching yield and TVL data across protocolsrisk-management: Portfolio-level yield allocation decisionsposition-sizing: How much capital to allocate to yield strategiesreferences/yield_math.md — Fee APR, APR/APY conversion, net yield formulas, break-even analysisreferences/sustainability_analysis.md — Emission sustainability metrics, death spiral patterns, real yield identificationscripts/yield_calculator.py — Offline yield calculator with fee APR, IL estimation, net yield, break-even, and sensitivity analysisscripts/yield_comparison.py — Fetches DeFiLlama yield data and compares Solana yield opportunities with risk-adjusted rankingIntegration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.
Build and distribute Expo development clients locally or via TestFlight
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.
Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.
Take agiprolabs/yield-analysis from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.