Polymarket Arbitrage Statistics
pm_arb_statsGet free statistics on Polymarket arbitrage: total opportunities, average spread, markets analyzed, and last update timestamp.
Instructions
Get statistics about the Polymarket arbitrage dataset: total opportunities tracked, average spread, markets analyzed, and last updated. Free endpoint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/pm_arb.ts:141-171 (handler)The handler function for the pm_arb_stats tool. It calls apiGet to fetch /api/v1/pm/arb/stats and returns the JSON response.
server.registerTool( "pm_arb_stats", { title: "Polymarket Arbitrage Statistics", description: "Get statistics about the Polymarket arbitrage dataset: total opportunities tracked, " + "average spread, markets analyzed, and last updated. Free endpoint.", inputSchema: {}, }, async () => { const res = await apiGet<PmArbStatsResponse>("/api/v1/pm/arb/stats"); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); - src/tools/pm_arb.ts:20-25 (schema)TypeScript interface defining the shape of the stats API response (dataset, source, update_frequency, stats).
interface PmArbStatsResponse { dataset: string; source: string; update_frequency: string; stats: Record<string, unknown>; } - src/index.ts:55-58 (registration)Registration of the pmArbTools function in the main MCP server setup, which includes the pm_arb_stats tool.
registerPmArbTools(server); registerPmResolutionTools(server); registerEconTools(server); registerPmMicroTools(server); - src/client.ts:44-76 (helper)The apiGet helper used by the handler to make HTTP GET requests to the Verilex API.
export async function apiGet<T = unknown>( path: string, params?: Record<string, string | number | undefined>, ): Promise<ApiResponse<T>> { const url = buildUrl(path, params); const headers: Record<string, string> = { Accept: "application/json", "User-Agent": "verilex-mcp-server/0.1.0", }; // Forward x402 payment token if present in env (for paid endpoints) const paymentToken = process.env.VERILEX_PAYMENT_TOKEN; if (paymentToken) { headers["X-Payment-Token"] = paymentToken; } const res = await fetch(url, { headers }); const data = (await res.json()) as T; const stale = res.headers.get("X-Data-Stale"); const lastUpdated = res.headers.get("X-Data-Last-Updated"); const ageSeconds = res.headers.get("X-Data-Age-Seconds"); return { ok: res.ok, status: res.status, data, stale: stale === "true", lastUpdated: lastUpdated ?? undefined, ageSeconds: ageSeconds ? Number(ageSeconds) : undefined, }; }