> For the complete documentation index, see [llms.txt](https://documentation.kodiak.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.kodiak.finance/developers/panda/subgraph.md).

# Subgraph

### Overview

The Panda Protocol subgraph indexes and provides structured access to protocol data through a GraphQL API. This documentation will help you integrate with our data layer effectively.

### Understanding the Subgraph

The subgraph serves as the backbone for accessing Panda Protocol's on-chain data. It processes and indexes:

* Pool deployments and configurations
* Trading activities and price movements
* Liquidity positions and migrations
* Token holder balances and distributions

<img src="/files/jAMX8koVbHlJYJBBqdWn" alt="" class="gitbook-drawing">

### When to Use the Subgraph

#### Perfect For

* Building trading interfaces requiring real-time pool data
* Creating analytics dashboards with historical data
* Tracking pool performance and market metrics
* Monitoring token holder distributions

### Accessing the Subgraph

```typescript
https://api.goldsky.com/api/public/project_clpx84oel0al201r78jsl0r3i/subgraphs/kodiak-panda-berachain-mainnet/latest/gn
```

### Quick Example

```graphql
# Fetch active pools with their latest metrics
{
  pandaPools(
    where: { 
      graduated: false,
      volumeUSD_gt: "0"
    }
    orderBy: volumeUSD
    orderDirection: desc
  ) {
    id
    price
    volumeUSD
    swapsCount
  }
}
```

### Data Structure

The subgraph maintains several core entities:

* `PandaPool`: Pool state and metrics
* `Token`: Token details and statistics
* `Swap`: Trading activity records
* `Holder`: Token holder information

For detailed entity definitions, see our Entities documentation.

### Development Guides

1. Entity Relationships
   * Understanding data models
   * Entity relationships
   * Field references
2. Query Examples
   * Common queries
   * Filtering and sorting
   * Pagination patterns
3. Advanced Usage
   * Performance optimization
   * Error handling
   * Edge cases

### Next Steps

[→ Continue to Entity Documentation](/developers/panda/subgraph/entity-reference.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.kodiak.finance/developers/panda/subgraph.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
