For the complete documentation index, see llms.txt. This page is also available as Markdown.

Query Guide

Introduction

This guide covers common query patterns, optimization techniques, and best practices for retrieving data from the Panda Protocol subgraph.

Basic Queries

Pool Data

# Get basic pool information
{
  pandaPool(id: "0x123...") {
    id
    price
    volumeUSD
    swapsCount
    graduated
  }
}

# List active pools with high volume
{
  pandaPools(
    where: {
      volumeUSD_gt: "100000",
      graduated: false
    }
    orderBy: volumeUSD
    orderDirection: desc
    first: 10
  ) {
    id
    price
    volumeUSD
  }
}

Trading Activity

Advanced Queries

Time-Based Queries

Market Analysis

Query Optimization

Pagination

Field Selection

Using Fragments

Common Use Cases

Trading Interface Data

Analytics Dashboard

Real-time Data Updates

Polling Strategy

Using Block Numbers

Error Handling

Null Checks

Block Timestamps

Best Practices

  1. Query Performance

    • Use pagination for large datasets

    • Select only needed fields

    • Optimize sorting and filtering

  2. Data Freshness

    • Consider indexing delays

    • Implement proper polling intervals

    • Use block numbers for consistency

  3. Error Recovery

    • Handle null entities gracefully

    • Validate data ranges

    • Implement retry logic

Next Steps

Continue to Advanced Usage for:

  • Complex query patterns

  • Performance optimization

  • Edge case handling

Last updated