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.
- 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
npm install @skynetxbt/flow-defillama
# or
yarn add @skynetxbt/flow-defillama
- @skynetxbt/core
- @skynetxbt/plugin-defillama
- @skynetxbt/agent
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"
});
// 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
}
// 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
}
// 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
}
// 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
}
// 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
}
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 }
}
}
The flow calculates comprehensive risk scores based on:
- TVL thresholds
- APY stability
- Protocol age
- Historical performance
- Market volatility
- IL (Impermanent Loss) risk
Intelligent analysis and recommendations using:
- Market trend analysis
- Risk-adjusted opportunities
- Protocol comparisons
- Chain ecosystem insights
- Fee generation patterns
Evaluates stability based on:
- APY volatility
- TVL consistency
- Protocol track record
- Asset composition
- Market conditions
-
Risk Management
- Use appropriate risk profiles
- Consider stability scores
- Monitor APY volatility
- Check IL risk exposure
-
Analysis Strategy
- Start with high-level protocol analysis
- Drill down into specific opportunities
- Compare across chains
- Monitor fee generation
-
Performance Optimization
- Cache frequently used data
- Use appropriate filters
- Monitor rate limits
- Handle API timeouts
-
Data Validation
- Verify TVL thresholds
- Check APY consistency
- Validate protocol data
- Monitor chain metrics