Skip to main content

Overview

The Yield Calculator lets you model potential returns before investing. Input any amount of STX or sBTC, select a protocol, and see projected earnings across daily, weekly, monthly, and yearly timeframes with compound growth visualization.

Key Features

Multi-Asset Support

Calculate yields for both STX and sBTC holdings

Live Protocol Data

APY rates pulled from DefiLlama every 5 minutes

Compound Modeling

Toggle compounding to see exponential growth over 12 months

Break-Even Analysis

See how long until your investment grows 10%

How It Works

Input Configuration

1

Set Investment Amount

Enter the amount you want to invest:
amount: '1000' // String value for input control
Switch between STX and sBTC for automatic USD conversion:
  • STX: Multiplied by current STX price (~$0.26)
  • sBTC: Multiplied by Bitcoin price (~$68,000)
2

Select Protocol

Choose from all Stacks DeFi protocols:
  • StackingDAO - 9.5% APY (Low Risk)
  • Velar Finance - 12% APY (Medium Risk)
  • Zest Protocol - 15% APY (High Risk)
  • ALEX - 10% APY (Medium Risk)
  • And more…
Each protocol shows:
  • Logo and name
  • Risk badge (Low/Medium/High)
  • Current APY from live data
3

Toggle Compounding

Enable Compound Rewards to model reinvesting earnings:
  • ON: Daily compound growth (365x per year)
  • OFF: Simple interest calculation

Calculation Logic

Return Projections

The calculator uses precise compound interest formulas:
function calcReturns(amount, apy, compound = true) {
  const r = apy / 100;
  
  // Compound: A = P(1 + r/n)^(nt) - P
  // Simple: A = P * r * t
  
  const calc = (t) => compound
    ? amount * Math.pow(1 + r / 365, 365 * t) - amount
    : amount * r * t;
    
  return {
    daily: calc(1 / 365),
    weekly: calc(7 / 365),
    monthly: calc(1 / 12),
    yearly: calc(1)
  };
}

Break-Even Time

Calculates months to reach 10% growth:
const breakEvenMonths = Math.ceil(
  Math.log(1.1) / Math.log(1 + apy / 100 / 12)
);
Example: At 9.5% APY, you’ll reach +10% in ~13 months.

Output Display

Return Grid

Four time periods with color-coded gains:
┌─────────────┬─────────────┐
│ DAILY       │ WEEKLY      │
│ +$0.65      │ +$4.55      │
│ 2.50 STX    │ 17.50 STX   │
├─────────────┼─────────────┤
│ MONTHLY     │ YEARLY      │
│ +$19.58     │ +$241.23    │
│ 75.31 STX   │ 927.81 STX  │
└─────────────┴─────────────┘
Each cell shows:
  • USD value in green (primary)
  • Token equivalent in muted text (STX or BTC)

APY Summary Card

Highlights selected protocol:
  • Large APY percentage in Bitcoin orange
  • Protocol name and type
  • Risk badge (color-coded)
  • 2x2 grid of return projections

Compound Growth Chart

12-month visualization using Recharts:
const curve = Array.from({ length: 13 }, (_, i) => ({
  month: i === 0 ? 'Now' : `M${i}`,
  value: amount * Math.pow(1 + apy / 100 / 12, i)
}));

// Example output:
// [{ month: 'Now', value: 1000 },
//  { month: 'M1', value: 1007.92 },
//  { month: 'M2', value: 1015.90 },
//  ...
//  { month: 'M12', value: 1099.56 }]
Chart features:
  • Bitcoin orange gradient fill
  • Interactive tooltips with exact values
  • Responsive to window size
  • Month labels (M1-M12)

Risk Indicators

Risk badges help you evaluate protocol safety:

Low Risk (Green)

  • Audited smart contracts
  • Established protocols (StackingDAO)
  • Conservative yields (5-10% APY)
  • High TVL (Total Value Locked)

Medium Risk (Orange)

  • Some audit coverage
  • Growing protocols (Velar, ALEX)
  • Moderate yields (10-15% APY)
  • Medium TVL

High Risk (Red)

  • New or unaudited contracts
  • Experimental protocols
  • High yields (15%+ APY)
  • Lower TVL
Higher APY = Higher Risk. Always research protocols before investing. Use the Protocol Comparison tool to check audits and TVL.

Real-World Example

Scenario: 5,000 STX in StackingDAO

Input:
  • Amount: 5000
  • Asset: STX
  • Protocol: StackingDAO
  • APY: 9.5%
  • Compound: ON
Output:
Daily Return:    +$0.034 USD  (0.13 STX)
Weekly Return:   +$0.238 USD  (0.92 STX)
Monthly Return:  +$1.026 USD  (3.95 STX)
Yearly Return:   +$12.65 USD  (48.65 STX)

Break-even: ~13 months to reach +10%
12-month growth: 1,3001,300 → 1,424.50 USD

Code Reference

Key implementation files:
  • Page: src/pages/YieldCalculator.jsx - Main calculator UI
  • Hook: src/hooks/useProtocolData.js - Live APY data
  • Service: src/services/defiLlamaService.js - Protocol data fetching
  • Formulas: src/pages/YieldCalculator.jsx:16-36 - Return calculations

Advanced Usage

Comparing Multiple Protocols

Strategy: Calculate the same amount across 3-4 protocols to find the best risk/reward balance for your portfolio.
Example comparison for 1,000 STX:
ProtocolAPYYearly ReturnRisk
StackingDAO9.5%+95 STXLow
Velar12%+120 STXMedium
Zest15%+150 STXHigh

Impact of Compounding

Compounding dramatically increases returns over time: Without Compounding (Simple Interest):
$1,000 @ 10% APY for 1 year = $1,100 (+$100)
With Daily Compounding:
$1,000 @ 10% APY for 1 year = $1,105.16 (+$105.16)
The difference grows exponentially over longer periods:
  • 1 year: +5% more
  • 5 years: +28% more
  • 10 years: +69% more

Mobile Optimization

The calculator is fully responsive:
  • Input panel stacks on mobile (< 1024px)
  • Chart adjusts to screen width
  • Touch-friendly protocol selector buttons
  • Readable font sizes on small screens

Data Accuracy

APY data is fetched from DefiLlama every 5 minutes and represents current protocol rates. Actual yields may vary based on:
  • Market conditions
  • Protocol utilization
  • Asset price volatility
  • Smart contract performance
Loading states show while fetching:
{loading && p.apy == null
  ? <span></span>
  : p.apyDisplay ?? '—'
}

Troubleshooting

APY shows ”—” for some protocols:
  • Protocol may not report APY to DefiLlama
  • Fallback to protocol’s published rate (marked with ~)
  • Check Protocol Comparison for manual verification
Chart not displaying:
  • Ensure amount > 0
  • Check browser console for errors
  • Try selecting a different protocol
  • Recharts library must be loaded
Calculations seem off:
  • Verify compound toggle state
  • USD conversion uses fixed prices (STX: 0.26,BTC:0.26, BTC: 68,000)
  • Large amounts may show rounding differences
  • Calculator assumes constant APY (real yields fluctuate)

Best Practices

Start Small

Test with 10% of intended investment to verify yields

Diversify

Don’t put all funds in highest APY—balance risk

Monitor APY

Rates change—recalculate monthly or when markets shift

Account for Fees

Calculator shows gross yield—subtract gas fees and protocol fees

Next Steps

Protocol Comparison

Compare all protocols side-by-side with TVL and audit status

AI Copilot

Get AI-powered allocation recommendations

Build docs developers (and LLMs) love