Backtesting cross-chain stablecoin yield strategies across protocols and chains that Ymax supports. All data sourced from DefiLlama's public yields API -- no API keys needed.
npm install
npm run backtest:allTests only the 12 USDC instruments Ymax currently supports:
- Protocols: Aave V3, Compound V3, Morpho curator vaults
- Chains: Ethereum, Arbitrum, Base, Optimism, Avalanche
- Asset: USDC only
npm run backtest:ymaxKey finding: Cross-chain beats every single chain by +114bps before bridge costs. After conservative 5bps bridge costs, within -19bps of the best single chain (Base). The best chain rotated 7 times across 10 quarters -- Arbitrum (2024), Base (mid-2024), Ethereum (2025) via Morpho vaults.
Adds protocols beyond what Ymax currently supports to show the broader USDC yield landscape:
- Protocols: Aave V3, Compound V3, Fluid, Dolomite, SparkLend, Euler V2, Silo V2, Moonwell, Benqi, DeltaPrime, Folks Finance
- Chains: Ethereum, Arbitrum, Base, Avalanche
- Asset: USDC only
npm run backtest:usdc-4chainKey finding: Cross-chain beats best single chain by +66bps after costs. DeltaPrime on Avalanche provided 52% of best-yield days. Adding more protocols widens the cross-chain advantage.
The full analysis including non-USDC stablecoins:
- Protocols: Aave V3, Compound V3, Fluid, Euler V2, Dolomite, SparkLend, Sky, Ethena, Pendle, Moonwell, Spark
- Chains: Ethereum, Base, Arbitrum, Avalanche, Plasma
- Assets: USDC, USDT, sUSDe (Ethena), sUSDS (Sky), Pendle SY underlying yield
npm run backtest:multi-assetKey finding: Three asset types each dominated different eras -- USDC (57%), sUSDe (25%), Pendle (18%). Multi-asset allocation matters as much as multi-chain.
- Period: January 1, 2024 - present (~27 months)
- Data source: DefiLlama Yields API (free, no auth, daily granularity)
- Initial capital: $100,000
- Rebalancing: Weekly (every 7 days, evaluate cross-chain)
- Bridge cost: 5 basis points per cross-chain move (conservative; CCTP is roughly free for USDC)
- Compounding: Daily (
value *= (1 + bestDailyApy / 365))
For each day, we identify the best available yield on each chain across all protocols with data, then simulate single-chain vs cross-chain strategies.
Each backtest prints a formatted report to stdout and saves detailed JSON results to output/:
| File | Backtest |
|---|---|
output/ymax-backtest.json |
Ymax instruments only |
output/usdc-4chain-backtest.json |
Expanded USDC |
output/backtest-results-v4.json |
Multi-asset |
Older iterations are preserved in output/backtest-results-v[1-3].json.
See cross-chain-yield-analysis.md for the complete analysis with investor framing.
All yield data from DefiLlama's public API:
GET https://yields.llama.fi/chart/{poolId}
Returns daily {timestamp, apy, tvlUsd}. Pool IDs are hardcoded in each script -- they're stable UUIDs tied to specific protocol/chain/asset combinations. No API key or authentication needed.
- Node.js 18+ (for native
fetch) - npm