Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

πŸš€ DefiLlama Data Aggregator

πŸ“Š Overview

DefiLlama Data Aggregator is a professional-grade command-line tool that provides unified access to DefiLlama's comprehensive DeFi data. It supports querying Total Value Locked (TVL), protocol data, chain statistics, and yield pool information with built-in security validation and error handling.


🎯 Features

  • βœ… DeFi TVL - Total DeFi TVL and chain-level TVL
  • βœ… Protocol Data - Protocol details, listings, and rankings
  • βœ… Chain Data - Individual chain TVL and statistics
  • βœ… Yield Pools - Yield rate queries and filtering
  • βœ… Health Monitoring - API health status monitoring
  • βœ… Security Validation - Input sanitization and error handling
  • βœ… Flexible Output - Pretty/Table/JSON/CSV formats

πŸ“¦ Installation

Prerequisites

  • Node.js >= 16.0.0
  • npm (comes with Node.js)

Install Dependencies

cd /workspace/projects/workspace/skills/defillama-data-aggregator
npm install

Create Symbolic Link (Optional)

npm link

This creates a global defillama-data command that you can use from anywhere.


πŸš€ Quick Start

Basic Usage

# View version
defillama-data --version
# Get total DeFi TVL
defillama-data defillama tvl
# Get protocol TVL
defillama-data defillama protocol -n aave
# Get protocol rankings
defillama-data defillama protocols --limit 10 --sort tvl -f table
# Find high-yield pools
defillama-data defillama yields --min-apy 10 --limit 20 -f table
# Check API health
defillama-data health
# View system status
defillama-data status

πŸ“– Commands

1. Get Total DeFi TVL

Get the total value locked across all DeFi protocols.

defillama-data defillama tvl [options]

Options:

  • -f, --format <type>: Output format (json, table, csv, pretty) - Default: pretty

Example:

defillama-data defillama tvl
defillama-data defillama tvl -f json | jq '.totalTvl'

Response:

{
 "totalTvl": 94518602394.26,
 "chains": [...],
 "timestamp": "2026εΉ΄03月27ζ—₯T09:00:00.000Z"
}

2. Get Protocol TVL

Get TVL for a specific protocol.

defillama-data defillama protocol -n <name> [options]

Required Options:

  • -n, --name <name>: Protocol name (e.g., aave, uniswap, compound)

Options:

  • -f, --format <type>: Output format (json, table, csv, pretty) - Default: pretty

Example:

defillama-data defillama protocol -n aave
defillama-data defillama protocol -n uniswap -f json

Validation Rules:

  • Only alphanumeric characters and hyphens allowed
  • Length: 1-50 characters
  • Automatically converted to lowercase

Valid Examples: aave, uniswap-v3, compound-protocol Invalid Examples: aave<script>, uni/swap, aave&x


3. Get All Protocols

Get a list of all protocols with filtering and sorting.

defillama-data defillama protocols [options]

Options:

  • -c, --category <name>: Filter by category (e.g., lending, dex)
  • --min-tvl <amount>: Minimum TVL in USD
  • --limit <number>: Limit results (1-500)
  • --sort <field>: Sort by field (tvl) - Default: tvl
  • -f, --format <type>: Output format (json, table, csv, pretty) - Default: pretty

Example:

# Get all protocols
defillama-data defillama protocols
# Sort by TVL, top 20
defillama-data defillama protocols --sort tvl --limit 20
# Filter lending protocols
defillama-data defillama protocols -c lending --min-tvl 100000000
# Combined filters
defillama-data defillama protocols -c lending --min-tvl 100000000 --limit 50 --sort tvl -f table

4. Get Chain TVL

Get TVL for a specific blockchain.

defillama-data defillama chain -n <name> [options]

Required Options:

  • -n, --name <name>: Chain name (e.g., ethereum, solana, polygon)

Options:

  • -f, --format <type>: Output format (json, table, csv, pretty) - Default: pretty

Example:

defillama-data defillama chain -n ethereum
defillama-data defillama chain -n solana -f json

5. Get Yield Pools

Get yield pool information with filtering.

defillama-data defillama yields [options]

Options:

  • --min-apy <number>: Minimum APY percentage (0-1000)
  • --min-tvl <number>: Minimum TVL in USD
  • --chain <name>: Filter by chain name (e.g., ethereum, arbitrum)
  • --stablecoin: Filter stablecoin pools only
  • --limit <number>: Limit results (1-500)
  • -f, --format <type>: Output format (json, table, csv, pretty) - Default: pretty

Example:

# Get all yield pools
defillama-data defillama yields
# High APY pools (APY > 10%)
defillama-data defillama yields --min-apy 10
# Ethereum high-yield pools
defillama-data defillama yields --chain ethereum --min-apy 5
# Combined filters
defillama-data defillama yields --min-apy 10 --chain ethereum --min-tvl 1000000 --limit 20 -f table

6. Health Check

Check API health status.

defillama-data health [options]

Options:

  • -q, --quiet: Quiet mode (summary only)
  • --timeout <ms>: Request timeout in milliseconds - Default: 5000

Example:

# Full health check
defillama-data health
# Quiet mode
defillama-data health --quiet
# Custom timeout
defillama-data health --timeout 10000

7. System Status

Display system status and available platforms.

defillama-data status

Example:

defillama-data status

πŸ› οΈ Configuration

Setup Configuration File (Optional)

# Copy example configuration
cp config/keys.example.js config/keys.js

Configuration Example

// config/keys.js
module.exports = {
 defillama: {
 baseUrl: 'https://api.llama.fi'
 },
 settings: {
 defaultCacheDuration: 300, // Cache duration in seconds
 timeout: 30000, // Request timeout in milliseconds
 maxRetries: 3, // Maximum retry attempts
 retryDelay: 1000, // Retry delay in milliseconds
 debug: process.env.DEBUG === 'true' // Enable debug logging
 }
};

πŸ’‘ Usage Examples

Monitor Lending Protocols

# Get top 10 lending protocols by TVL
defillama-data defillama protocols -c lending --limit 10 --sort tvl -f table

Find High-Yield Pools

# Find high-yield pools on Ethereum with APY > 10%
defillama-data defillama yields --chain ethereum --min-apy 10 --min-tvl 1000000 --limit 20 -f table

Compare Chain TVL

# Compare TVL across multiple chains
for chain in ethereum solana polygon arbitrum avalanche; do
 echo "=== $chain ==="
 defillama-data defillama chain -n $chain -f json | jq '.tvl'
done

Export Data for Analysis

# Export protocols to CSV
defillama-data defillama protocols --limit 100 -f csv > protocols.csv
# Export yields to CSV
defillama-data defillama yields --limit 100 -f csv > yields.csv

πŸ“š Documentation

Document Description
README.md User manual (this file)
SKILL.md Skill technical documentation
QUICK_REFERENCE.md Quick reference card
FULL_FEATURE_LIST.md Complete feature list
DEPLOYMENT_CHECKLIST.md Deployment checklist
LAUNCH_REPORT.md Launch report

🌐 API Documentation

For detailed DefiLlama API documentation:

Maintainer: Antalpha AI Team

About

Professional DefiLlama data aggregator with security validation - DeFi TVL, protocols, chains, and yields data

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /