Market Data - API

The API access documentation for real-time market data for Lillo framework.

Overview

The Market Data API provides access to real-time cryptocurrency market data through a combination of DexScreener and CoinGecko integrations. All requests are proxied through our webapp endpoint for rate limiting and error handling.

Endpoints

Market Data Endpoint

GET ${WEBAPP_URL}/api/market/dex

Query Parameters

  • type: The type of data to fetch

    • ticker - Token lookup by symbol

    • ca - Token lookup by contract address

    • trending - Trending Solana tokens

    • latest - Latest Solana pairs

    • boosted - Boosted Solana tokens

  • address: Token symbol or address (required for ticker/ca types)

Response Format

Data Types

TokenData

Error Handling

All endpoints follow a consistent error response format:

Common error codes:

  • 400 - Missing or invalid parameters

  • 404 - Token not found

  • 500 - Server error

Retry Logic

  • Maximum 3 retry attempts

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

  • Clear error messages on failure

Best Practices

  1. Error Handling

    • Implement proper error catching

    • Handle network failures gracefully

    • Provide meaningful error messages

  2. Rate Limiting

    • Respect API rate limits

    • Implement backoff strategies

    • Handle rate limit errors appropriately

  3. Data Processing

    • Filter by Solana chain where applicable

    • Sort by appropriate metrics (volume, liquidity)

    • Format numbers for display

CoinGecko Market Data

Fetches market data from CoinGecko for major cryptocurrencies.

Query Parameters

  • type (optional): Data type to fetch

    • market (default) - Top 50 by market cap

    • trending - Trending coins

Response Format

Example Requests

  1. Top Market Cap

  1. Trending Coins

Error Codes

  • 500 - Server error or CoinGecko API error

TradingView Chart Data

Processes trading pair symbols for TradingView chart integration.

Query Parameters

  • symbol (required): Trading pair symbol (e.g., "BTCUSD")

Response Format

Example Request

Error Codes

  • 400 - Missing or invalid symbol

  • 500 - Processing error

Data Types

Token Data

DEX Pair Data

Rate Limiting

  • DexScreener: Standard rate limits apply

  • CoinGecko: Free tier rate limits apply

  • Cache implemented for frequent requests

Error Handling

All endpoints follow a consistent error response format:

Common error scenarios:

  1. Invalid parameters

  2. Token not found

  3. Rate limit exceeded

  4. External API errors

  5. Network issues

Best Practices

  1. Caching

    • Cache responses when possible

    • Respect cache headers

    • Implement retry logic

  2. Rate Limiting

    • Implement backoff strategies

    • Cache frequently accessed data

    • Monitor usage limits

  3. Error Handling

    • Implement proper error catching

    • Provide meaningful error messages

    • Log errors appropriately

  4. Security

    • Validate input parameters

    • Sanitize responses

    • Monitor for abuse

Last updated