SKILL.md
Analyzing On-Chain Data
Overview
Analyze DeFi protocol metrics, chain-level TVL, fee revenue, DEX volumes, yield opportunities, and stablecoin market caps using DeFiLlama as the primary data source. Designed for DeFi researchers, protocol analysts, and yield farmers who need programmatic access to on-chain analytics without writing custom subgraph queries.
Prerequisites
- Python 3.8+ with
requestslibrary installed - DeFiLlama API access (free, no key required for most endpoints)
- Optional: CoinGecko API key for supplementary token price data
onchain_analytics.pyCLI script available in the plugin directorydata_fetcher.pyandmetrics_calculator.pymodules for programmatic usage
Instructions
- Run
python onchain_analytics.py protocolsto retrieve the top DeFi protocols ranked by total value locked (TVL). - Filter protocol results by category using
--category lending,--category dex, or--category "liquid staking"to narrow the scope. - Filter by chain with
--chain ethereumor--chain arbitrumto isolate chain-specific protocol data. - Sort results by alternative metrics using
--sort market_shareor--sort tvl_to_mcapto surface undervalued protocols. - Run
python onchain_analytics.py chainsto retrieve chain-level TVL rankings across all tracked networks. - Run
python onchain_analytics.py fees --protocol aaveto pull fee and revenue data for a specific protocol. - Run
python onchain_analytics.py dex --chain ethereumto analyze DEX trading volumes filtered by chain. - Run
python onchain_analytics.py yields --min-tvl 5000000 --chain ethereumto identify yield opportunities above a minimum TVL threshold. - Run
python onchain_analytics.py trends --threshold 5to detect protocols with significant TVL changes (threshold is percentage).
