@skynetxbt/flow-defillama
TypeScript icon, indicating that this package has built-in type declarations

1.4.28 • Public • Published

DeFi Llama Flow

A SkynetXBT flow for comprehensive DeFi analytics and insights using the DeFi Llama plugin. This flow provides intelligent analysis of yields, protocols, chains, DEXs, and fees with LLM-powered recommendations.

Features

  • Yield farming analytics and recommendations
  • Protocol analysis and risk assessment
  • Chain analytics and market insights
  • DEX volume and metrics analysis
  • Fee and revenue analytics
  • LLM-powered insights and recommendations
  • Risk-adjusted analysis and scoring

Installation

npm install @skynetxbt/flow-defillama
# or
yarn add @skynetxbt/flow-defillama

Dependencies

  • @skynetxbt/core
  • @skynetxbt/plugin-defillama
  • @skynetxbt/agent

Usage

import { FlowDefiLlama } from '@skynetxbt/flow-defillama';

// Initialize the flow
const flow = new FlowDefiLlama();

// Execute analysis with natural language
const result = await flow.execute({
  message: "find high yield opportunities on Arbitrum with at least 5% APY"
});

// Get protocol analysis
const result = await flow.execute({
  message: "analyze top 5 lending protocols by TVL"
});

Analysis Types

1. Yield Analysis

// Find yield opportunities with filters
const analysis = await flow.execute({
  message: "find yield pools with minimum 1M TVL and 10% APY on Ethereum"
});

// Response includes:
{
  type: "yield",
  data: [{
    pool: string,
    protocol: string,
    chain: string,
    apy: number,
    tvl: number,
    riskScore: number,
    stabilityScore: number,
    recommendation: string,
    metrics: {
      apyBase: number,
      apyReward: number,
      apyPct7D: number,
      apyPct30D: number
    },
    risk: {
      ilRisk: string,
      exposure: string[],
      stablecoin: boolean
    }
  }],
  summary: string,
  recommendations: string
}

2. Protocol Analysis

// Analyze DeFi protocols
const analysis = await flow.execute({
  message: "analyze top lending protocols"
});

// Response includes:
{
  type: "protocol",
  data: [{
    name: string,
    category: string,
    tvl: number,
    volume24h: number,
    fees24h: number,
    marketShare: number,
    riskLevel: string,
    recommendation: string
  }],
  summary: string,
  recommendations: string
}

3. Chain Analysis

// Analyze blockchain networks
const analysis = await flow.execute({
  message: "compare L2 chains by TVL"
});

// Response includes:
{
  type: "chain",
  data: [{
    name: string,
    tvl: number,
    dominance: number,
    protocols: number,
    fees24h: number,
    growth7d: number,
    recommendation: string
  }],
  summary: string,
  recommendations: string
}

4. DEX Analysis

// Analyze DEX metrics
const analysis = await flow.execute({
  message: "analyze top DEXs by volume"
});

// Response includes:
{
  type: "dex",
  data: [{
    name: string,
    volume24h: number,
    volume7d: number,
    volumeChange24h: number,
    marketShare: number,
    chains: string[]
  }],
  summary: string,
  recommendations: string
}

5. Fee Analysis

// Analyze protocol fees and revenue
const analysis = await flow.execute({
  message: "find protocols with highest fees"
});

// Response includes:
{
  type: "fee",
  data: [{
    name: string,
    fees24h: number,
    fees7d: number,
    revenue24h: number,
    totalRevenue: number,
    feeChange24h: number
  }],
  summary: string,
  recommendations: string
}

Risk Profiles

The flow supports multiple risk profiles for analysis:

type RiskProfile = {
  ultraConservative: {
    minTvl: 10000000,    // $10M
    targetApy: { min: 1, max: 5 }
  },
  conservative: {
    minTvl: 5000000,     // $5M
    targetApy: { min: 3, max: 10 }
  },
  moderate: {
    minTvl: 1000000,     // $1M
    targetApy: { min: 5, max: 20 }
  },
  aggressive: {
    minTvl: 500000,      // $500K
    targetApy: { min: 10, max: 40 }
  },
  ultraAggressive: {
    minTvl: 100000,      // $100K
    targetApy: { min: 20, max: 100 }
  }
}

Advanced Features

Risk Scoring

The flow calculates comprehensive risk scores based on:

  • TVL thresholds
  • APY stability
  • Protocol age
  • Historical performance
  • Market volatility
  • IL (Impermanent Loss) risk

LLM-Powered Analysis

Intelligent analysis and recommendations using:

  • Market trend analysis
  • Risk-adjusted opportunities
  • Protocol comparisons
  • Chain ecosystem insights
  • Fee generation patterns

Stability Scoring

Evaluates stability based on:

  • APY volatility
  • TVL consistency
  • Protocol track record
  • Asset composition
  • Market conditions

Best Practices

  1. Risk Management

    • Use appropriate risk profiles
    • Consider stability scores
    • Monitor APY volatility
    • Check IL risk exposure
  2. Analysis Strategy

    • Start with high-level protocol analysis
    • Drill down into specific opportunities
    • Compare across chains
    • Monitor fee generation
  3. Performance Optimization

    • Cache frequently used data
    • Use appropriate filters
    • Monitor rate limits
    • Handle API timeouts
  4. Data Validation

    • Verify TVL thresholds
    • Check APY consistency
    • Validate protocol data
    • Monitor chain metrics

Readme

Keywords

none

Package Sidebar

Install

npm i @skynetxbt/flow-defillama

Weekly Downloads

1,110

Version

1.4.28

License

none

Unpacked Size

92.1 kB

Total Files

18

Last publish

Collaborators

  • mitrasish
  • 0xarpit