query_dex_volume
Retrieve DEX trading pair volume statistics including 24h and 7d volume, trade counts, and volume trends across multiple blockchain networks.
Instructions
Get volume statistics for DEX trading pairs. Shows 24h volume, 7d volume, trade count, and volume trends by pair and chain. Cost: $0.005 per query. Source: On-chain DEX analytics.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | No | Trading pair (e.g. WETH-USDC) | |
| chain | No | Filter by blockchain network | |
| period | No | Volume aggregation period (default: 24h) | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/dex.ts:164-223 (handler)The `query_dex_volume` tool is defined here, including its input schema and the handler that fetches data from the `/api/v1/dex/volume` endpoint.
server.registerTool( "query_dex_volume", { title: "Query DEX Volume", description: "Get volume statistics for DEX trading pairs. Shows 24h volume, 7d volume, " + "trade count, and volume trends by pair and chain. " + "Cost: $0.005 per query. Source: On-chain DEX analytics.", inputSchema: { pair: z .string() .optional() .describe("Trading pair (e.g. WETH-USDC)"), chain: z .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"]) .optional() .describe("Filter by blockchain network"), period: z .enum(["24h", "7d", "30d"]) .optional() .describe("Volume aggregation period (default: 24h)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, async ({ pair, chain, period, limit }) => { const res = await apiGet<DexQueryResponse>("/api/v1/dex/volume", { pair, chain, period: period ?? "24h", limit: limit ?? 25, }); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const warn = stalenessWarning(res); const summary = `${warn}Found ${count} DEX volume record(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, );