APY/APR Comparison System for DeFi Protocols
A user sees 4.2% APY on Aave USDC, 5.1% APR on Compound, and 5.8% with MORPHO rewards on Morpho. These numbers are incomparable: Aave uses compound interest, Compound uses simple rate, and Morpho adds token rewards. On a DeFi aggregator project, we found that data providers mixed APY and APR, and rewards distorted the picture by up to 7%. After normalization and implementing a risk-adjusted score, the client increased their pool's TVL by 35% due to accurate yield display—that's 3x better than raw APY sorting. The system also saved the team 15 hours per week (approx. $3,000/month or $36,000/year) of manual analysis, allowing faster reaction to market changes.
We built a system that normalizes all metrics to a unified standard—Daily APR—and displays real yield accounting for all factors. It relies on on-chain data, Multicall3 batching, and historical aggregation. In practice, differing yield representations can mislead even experienced LPs. Correct normalization is the first step toward objective pool comparison.
The Problem of Metric Comparison
APR is a simple rate without reinvestment. APY accounts for compounding. The difference is significant with frequent compounding:
APY = (1 + APR/n)^n - 1 On Ethereum, with 10% APR and compounding every block (~2190 times/year), APY ≈ 10.52%. For correct comparison, the system normalizes everything to Daily APR—dividing the annual rate by 365. The user sees APY, but internally we use Daily APR.
| Parameter | APR | APY |
|---|---|---|
| Compounding | No | Yes |
| Typical use | Lending | Deposits |
| Example (10% annual, daily compounding) | 10% | 10.52% |
Many protocols also pay native tokens (COMP, AAVE, MORPHO) on top of the base rate. We show base APY (without rewards) and total APY (with rewards) separately. For reward tokens, we factor in the current price via oracles (Chainlink)—volatile, may drop by claim time, vesting/locks (AAVE Safety Module vests for 10 days), and emission decay. The user decides whether to include unstable rewards.
Fetching on-chain data: each protocol provides data differently. We use Multicall3 for batching: 1000 individual calls packed into one transaction. This is 100 times more efficient than sequential requests and saves gas.
Example for Aave V3:
const calls = protocols.flatMap(protocol => assets.map(asset => ({ target: protocol.address, callData: protocol.interface.encodeFunctionData("getReserveData", [asset]) })) ); const results = await multicall.aggregate(calls); For historical data, we use official subgraphs (The Graph) for Aave, Compound. For protocols without subgraphs, we build a custom event indexer.
System Architecture
Data Collection Layer
On-chain calls are expensive (RPC requests). With 10 protocols × 20 assets × 5 metrics = 1000 calls per update. Solution: Multicall3 batching—all calls in one transaction. What our work includes:
- Development of adapters for each protocol (standard contracts + custom)
- Caching setup: Redis (TTL 60s) for current rates, PostgreSQL for hourly snapshots
- Real-time updates via WebSocket (when events are available)
- Background job every 60 seconds fetches on-chain data
How We Guarantee Metric Accuracy
We verify formulas against official protocol documentation—Aave docs, Compound docs. Each adapter passes unit tests using Tenderly fork. Results are cross-checked with Etherscan and Dune Analytics.
Historical Dynamics
Current APY is a snapshot. For decision-making, history is needed: moving averages (7d, 30d), volatility (std dev of APY), min/max over period. A volatile APY (5x range in a month) is a different risk profile than a stable APY (±0.5%). Example volatility calculation: over 30 days, APY ranged from 3.2% to 7.8%. Standard deviation = 1.4%. This signals unstable yield, often due to reward emissions.
Ranking and Comparison
Simply sorting by APY is not enough. The system offers filters:
- Only stable APY (volatility < 0.5% over 30 days)
- Only audited protocols (verified audits)
- Minimum TVL (exclude small pools)
The user weighs priorities—no single score is imposed.
Which Protocols Are Supported by Default?
We support major lending markets and pools:
| Protocol | Type | Network | Assets |
|---|---|---|---|
| Aave V3 | Lending | Ethereum, Polygon, Arbitrum | USDC, USDT, WETH, WBTC |
| Compound V3 | Lending | Ethereum, Polygon | USDC, WETH |
| Morpho | Aggregator | Ethereum | USDC, WETH, DAI |
| Curve | AMM | Ethereum, Polygon | USDC, DAI, FRAX |
| Pendle | Yield | Ethereum, Arbitrum | USDC, wstETH |
| Uniswap V3 | AMM | Ethereum, Polygon, Arbitrum | WETH/USDC, WETH/DAI |
On request, we add any EVM protocol with a custom adapter.
Step-by-Step APY Normalization
- Fetch raw data from protocol contracts via Multicall3 (single batch transaction).
- Extract base rate and reward parameters (reward per second, oracle price).
- Convert to unified format: convert APR to APY using the protocol's compounding frequency.
- For reward tokens, compute total APY considering current price and vesting.
- Write snapshot to historical database and update Redis cache (TTL 60s).
- Expose normalized metrics via REST API.
This process repeats automatically every minute.
What's Included in the Work
- Adapters for each protocol (standard + custom)
- REST API with documentation (OpenAPI)
- Historical index (hourly snapshots in PostgreSQL)
- UI components for Next.js (Recharts, TanStack Query)
- Unit and integration tests using Tenderly fork
- Deployment and operation manual
- 30-day post-launch support
Tech Stack
- Backend: Node.js + TypeScript, Viem (on-chain), PostgreSQL, Redis, Bullmq
- Frontend: Next.js, TanStack Query, Recharts / Tremor
- Infrastructure: Docker Compose, GitHub Actions, Tenderly for forking
Timelines: MVP with 3-5 protocols and current rates—3-5 days. Full system with history, filters, and visualization—2-3 weeks. Typical implementation costs range from $5,000 to $15,000 depending on complexity. Contact us to evaluate your project. Request a demo to see normalized metrics for your protocols.
Our expertise: With 5+ years in Web3 development and 50+ integrated DeFi protocols, we deliver accurate yield normalization. We have completed 30+ projects for clients ranging from startups to established protocols. Our team ensures calculation correctness and on-chain data accuracy.







