get_market_daily_snapshots
Retrieve daily trading data including volume, trades, and fees for a specific market over a defined period to analyze market performance trends.
Instructions
Get daily volume, trades, and fees for a specific market over time.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conditionId | Yes | Market conditionId | |
| days | No |
Implementation Reference
- mcp-server/src/index.ts:612-621 (registration)Tool registration for get_market_daily_snapshots
server.registerTool( "get_market_daily_snapshots", { description: "Get daily volume, trades, and fees for a specific market over time.", inputSchema: { conditionId: z.string().describe("Market conditionId"), days: z.number().default(30), }, }, - mcp-server/src/index.ts:622-649 (handler)The handler logic for get_market_daily_snapshots, which queries market daily snapshots from both simple and negrisk sources.
async ({ conditionId, days }) => { try { const snapshotQuery = `{ marketDailySnapshots( where: { market: "${conditionId}" } first: ${days} orderBy: dayId orderDirection: desc ) { dayId date tradesCount volumeUSD buyVolumeUSD sellVolumeUSD feesUSD } }`; const [simpleData, negriskData, name] = await Promise.all([ querySimple(snapshotQuery).catch(() => ({ marketDailySnapshots: [] })), queryNegRisk(snapshotQuery).catch(() => ({ marketDailySnapshots: [] })), getMarketName(conditionId), ]); const snapshots = simpleData.marketDailySnapshots?.length > 0 ? simpleData.marketDailySnapshots : negriskData.marketDailySnapshots || []; return textResult({ market: name, conditionId, snapshots }); } catch (e) { return errorResult(e); }