get_top_pools_by_dex
Retrieve the most active liquidity pools on a specific decentralized exchange to analyze trading opportunities and market trends.
Instructions
Get top pools on a specific DEX
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | Yes | Network ID (e.g., 'eth', 'bsc', 'polygon_pos') | |
| dex | Yes | DEX ID (e.g., 'uniswap_v3', 'sushiswap') | |
| include | No | Attributes to include: 'base_token', 'quote_token', 'dex' (comma-separated) | |
| page | No | Page number for pagination (optional, default: 1) | |
| sort | No | Sort by: 'h24_tx_count_desc', 'h24_volume_usd_desc' (optional, default: 'h24_tx_count_desc') |
Implementation Reference
- Core implementation of getTopPoolsByDex: makes HTTP request to CoinGecko API /networks/{network}/dexes/{dex}/pools endpoint with query params
async getTopPoolsByDex(network, dex, options = {}) { try { const queryParams = new URLSearchParams(); if (options.include) queryParams.append('include', options.include); if (options.page) queryParams.append('page', options.page); if (options.sort) queryParams.append('sort', options.sort); const url = `${this.baseUrl}/networks/${network}/dexes/${dex}/pools${queryParams.toString() ? '?' + queryParams.toString() : ''}`; const response = await fetch(url, { headers: { 'x-cg-demo-api-key': this.apiKey } }); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } return await response.json(); } catch (error) { throw new Error(`Failed to get top pools by DEX: ${error.message}`); } }