Overview

Overview

Lillo provides comprehensive market data capabilities through DexScreener and CoinGecko integrations, focusing on real-time DEX data, global market information, and AI-powered market analysis.

Core Components

1. TokenData Interface

interface TokenData {
  baseToken: {
    address: string;
    name: string;
    symbol: string;
  };
  quoteToken: {
    name: string;
    symbol: string;
  };
  priceUsd: string;
  volume: {
    h24: number;
    h6: number;
    h1: number;
  };
  priceChange: {
    h24: string;
    h6: string;
    h1: string;
  };
  liquidity: {
    usd: number;
  };
  marketCap: number;
  fdv: number;
  txns: {
    h24: {
      buys: number;
      sells: number;
    };
  };
  profile?: {
    icon?: string;
    description?: string;
    links?: Array<{
      type: string;
      label: string;
      url: string;
    }>;
  };
}

Implementations

1. DexScreener Integration

Available Commands:

  • /dex trending (default) - Show top 10 from 50 trending tokens by volume

  • /dex latest - Show top 10 from 50 most recently created pairs

  • /dex boosted - Show top 10 from 50 most boosted tokens

Features:

  • Real-time DEX pair data

  • Trading volume analytics

  • Price discovery

  • New pair detection

  • AI-powered market analysis using GPT-4o-mini

2. CoinGecko Integration

Available Commands:

  • /gecko - Show top 10 from 50 coins by market cap

  • /gecko trending - Show trending coins

Features:

  • Global market data

  • Trending coins analysis

  • Market cap rankings

  • Volume analysis

  • AI-powered market analysis using GPT-4o-mini

3. Token Lookup System

Available Commands:

  • /ticker <symbol> - Get token information by symbol or address

Features:

  • Multi-source data aggregation

  • Real-time price updates

  • Detailed token information

  • Social link integration

  • AI-powered token analysis using GPT-4o-mini

AI Analysis Integration

1. Analysis Components

  • GPT-4o-mini model integration

  • Custom prompts for each command type

  • Market context awareness

  • Personality-driven analysis

2. Command-Specific Analysis

// Analysis function signature
async function analyzeMarketData(
  data: TokenData,
  agent: Agent
): Promise<string>

Features:

  • Market trend analysis

  • Price movement interpretation

  • Volume and liquidity insights

  • Personalized recommendations

API Integration

1. Market Data Endpoint

// Main endpoint
GET ${WEBAPP_URL}/api/market/dex
Query Parameters:
- type: 'ticker' | 'ca' | 'trending' | 'latest' | 'boosted'
- address?: string

2. Response Format

interface MarketResponse {
  content: string;  // Formatted market data
  error?: string;   // Error message if any
}

Utility Functions

1. Formatting

function formatLargeNumber(num: number): string
function formatPriceChange(change: string, iconOnly: boolean = false): string
function getLinkIcon(link: { type: string; url: string }): string

2. Data Processing

  • Number formatting with B/M/K suffixes

  • Price change formatting with emojis

  • Social link icon mapping

  • Token data display formatting

Best Practices

1. Data Quality

  • Multi-source verification

  • Error handling

  • Rate limiting

  • Retry logic

2. Performance

  • Maximum 3 retry attempts

  • Exponential backoff (1s, 2s, 3s)

  • Error recovery

  • Clear error messages

3. Security

  • API key management

  • Request validation

  • Error logging

  • Access control

Last updated