/api/2/trades/filters endpoint makes it easy to batch download trades across any blockchain with efficient cursor-based pagination.
This cookbook walks you through downloading large volumes of trade data efficiently.
Quick Start
Here’s the simplest way to download trades for a 1-hour window:Understanding the Endpoint
Key Parameters
Constraints
- Maximum timeframe: 1 hour per request
- Maximum results: 5000 per request
- Use cursor pagination to fetch more results within a timeframe
Batch Download Strategy
Step 1: Break Down Your Timeframe
Since each request is limited to 1 hour, break your target period into 1-hour chunks:Step 2: Paginate Within Each Chunk
Each 1-hour chunk may contain more than 5000 trades. Use cursor pagination to fetch all trades:Step 3: Complete Download Pipeline
Combine time chunking and pagination for a complete solution:Python Example
Working with the Response Data
Trade Object Structure
Each trade includes comprehensive data:Analytics Examples
Calculate total volume:Best Practices
Base/Quote token logic: When you provide a
tokenAddress filter, that token becomes the “base” token and the type field (buy/sell) is relative to it. Without a filter, token0 from the pool is used as base.