Yield Analysis logo

Yield Analysis

Community
agiprolabs
yield-analysis

DeFi yield evaluation including fee APR, real vs nominal yield, net APY after costs, and yield sustainability analysis

Overview

Publisheragiprolabs
Repositoryclaude-trading-skills
Skill nameyield-analysis
Stars
434
Forks
85
Bundled files
4
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by agiprolabs on GitHub. Read the source before you install it.

Installation

Install the Yield Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/agiprolabs/claude-trading-skills/tree/main/skills/yield-analysis
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git /tmp/claude-trading-skills
mkdir -p .claude/skills
cp -r /tmp/claude-trading-skills/skills/yield-analysis .claude/skills/yield-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Yield Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Yield Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Yield Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Yield Analysis — DeFi Yield Evaluation & Comparison

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.

Why Yield Analysis Matters

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:

  • LPs chase high-APY pools that destroy capital through IL
  • Emission-driven yields collapse as reward tokens lose value
  • Gas and rebalancing costs eat into thin margins
  • Opportunity cost is ignored (you could be staking SOL at ~7%)

Yield Components

Every DeFi yield breaks down into one or more of these sources:

1. Trading Fee Income

Swap fees earned by liquidity providers. This is the most sustainable yield source because it comes from real economic activity.

python
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.

2. Token Emissions / Incentives

Protocol reward tokens distributed to LPs. Often the largest component of advertised yields, but frequently unsustainable.

python
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.

3. Lending Interest

Interest earned from lending protocol deposits (Marginfi, Kamino, Solend). Driven by borrowing demand — more sustainable than emissions but fluctuates with utilization.

4. Staking Rewards

Validator staking yield (~7% APR on Solana) or liquid staking token (LST) yield. The baseline risk-free rate for the Solana ecosystem.

Real vs Nominal Yield

MetricWhat It IncludesWhat It Ignores
Nominal APYFee APR + emission APR (compounded)IL, gas, depreciation, risk
Real YieldEverything, net of all costsNothing — this is the true return

Real Yield Formula

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 value
  • emission_apr: annualized emission income at current token price
  • emission_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, compounds
  • rebalancing_cost: for CLMM positions, cost of rebalancing out-of-range positions

Example: SOL-USDC Pool

Nominal 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 Calculation

Constant-Product Pools

python
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%

Concentrated Liquidity (CLMM) Pools

CLMM fee income depends on your position range relative to trading activity:

python
# 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.

Per-LP Share

python
your_share = your_liquidity / total_pool_liquidity
your_daily_fees = total_daily_fees * your_share

Emission Sustainability

The Death Spiral Pattern

  1. Protocol launches with high emission rewards → attracts LPs
  2. TVL grows → yield per LP drops → protocol increases emissions
  3. LPs farm and dump emission tokens → token price drops
  4. Lower token price → lower USD-denominated yield
  5. LPs leave → TVL drops → protocol increases emissions further
  6. Spiral continues until emissions stop or protocol fails

Sustainability Metrics

python
# 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:

  • P/E < 20 and sustainability > 1.0: Likely sustainable yield
  • P/E 20-100 and sustainability 0.3-1.0: Moderate risk
  • P/E > 100 or sustainability < 0.3: Emission-dependent, high risk

Red Flags

  • APY > 100% sourced primarily from emissions
  • Emission token price declining consistently over 30+ days
  • TVL declining while emission rate stays constant or increases
  • Protocol revenue is a small fraction of emission cost
  • No vesting or lockup on emission tokens

Yield Comparison Framework

When comparing yield opportunities, normalize across these dimensions:

1. Same-Asset Basis

Compare like for like. For SOL:

StrategyExpected APRRisk LevelIL Exposure
Native staking~7%LowNone
Liquid staking (mSOL)~7.5%LowMinimal
SOL-USDC LP (Orca)~15-25%MediumHigh
SOL lending (Marginfi)~3-8%Low-MedNone
Leveraged yield~20-50%HighVaries

2. Risk-Adjusted Yield

python
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

3. Total Cost Accounting

Include all costs:

  • Impermanent loss (see impermanent-loss skill)
  • Gas fees for all transactions (deposit, withdraw, claim, compound)
  • Opportunity cost (what you could earn risk-free)
  • Smart contract risk premium
  • Rebalancing costs (CLMM positions)

Solana Yield Sources

Liquidity Provision

ProtocolPool TypesFee TiersNotes
RaydiumCPMM, CLMM0.01-1%Largest Solana DEX by volume
OrcaCLMM (Whirlpool)0.01-2%Concentrated liquidity focused
MeteoraDLMM, DynamicVariableDynamic fee adjustment

Lending

ProtocolAssetsTypical APRNotes
MarginfiSOL, USDC, etc.2-10%Points program active
KaminoSOL, USDC, etc.2-12%Auto-compound vaults
SolendSOL, USDC, etc.1-8%Established protocol

Staking

MethodAPRLock PeriodNotes
Native SOL staking~7%1 epoch (~2d)Validator selection matters
mSOL (Marinade)~7.2%InstantLiquid, usable in DeFi
jitoSOL (Jito)~7.5%InstantIncludes MEV rewards
bSOL (BlazeStake)~7%InstantDecentralized validator set

Data Sources

DeFiLlama Yields API (Free, No Auth)

python
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.

Protocol-Specific APIs

  • Raydium: https://api-v3.raydium.io/pools/info/list
  • Orca: https://api.mainnet.orca.so/v1/whirlpool/list
  • Marginfi: On-chain account data via Solana RPC

Integration with Other Skills

  • lp-math: AMM formulas for fee calculation and position math
  • impermanent-loss: IL estimation for real yield calculation
  • defillama-api: Fetching yield and TVL data across protocols
  • risk-management: Portfolio-level yield allocation decisions
  • position-sizing: How much capital to allocate to yield strategies

Files

References

  • references/yield_math.md — Fee APR, APR/APY conversion, net yield formulas, break-even analysis
  • references/sustainability_analysis.md — Emission sustainability metrics, death spiral patterns, real yield identification

Scripts

  • scripts/yield_calculator.py — Offline yield calculator with fee APR, IL estimation, net yield, break-even, and sensitivity analysis
  • scripts/yield_comparison.py — Fetches DeFiLlama yield data and compares Solana yield opportunities with risk-adjusted ranking

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Yield Analysis AI skill do?

DeFi yield evaluation including fee APR, real vs nominal yield, net APY after costs, and yield sustainability analysis

Why use Yield Analysis on TypingMind?

Because you install it once and use it with any model. Yield Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Yield Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/agiprolabs/claude-trading-skills/tree/main/skills/yield-analysis. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Yield Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Yield Analysis?

As many as you like. As long as a model supports skills, you can use Yield Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Yield Analysis AI skill free?

Yes. It is published on GitHub by agiprolabs under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇