historical_token_prices
Retrieve historical ERC20 and native token price data for specified date ranges across multiple blockchain networks. Query token price history in various currencies to analyze market trends and performance.
Instructions
Get the historical prices of one (or many) large cap ERC20 tokens between specified date ranges. Also supports native tokens. Required: chainName (blockchain network), quoteCurrency (price currency), contractAddress (token contract), from (start date YYYY-MM-DD), to (end date YYYY-MM-DD). Optional: pricesAtAsc (set to true for chronological ascending order, default is false for descending order). Returns historical token prices for the specified time range.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | Yes | The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet'). | |
| quoteCurrency | Yes | Currency to quote token prices in (e.g., 'USD', 'EUR'). This determines the currency for historical price data. | |
| contractAddress | Yes | The token contract address to get historical prices for. Use the native token address for native token prices. Supports ENS, RNS, Lens Handle, and Unstoppable Domain resolution. | |
| from | Yes | Start date for historical price data in YYYY-MM-DD format (e.g., '2023-01-01'). | |
| to | Yes | End date for historical price data in YYYY-MM-DD format (e.g., '2023-12-31'). | |
| pricesAtAsc | No | Sort prices in ascending chronological order. Default is false (descending order, newest first). |
Implementation Reference
- src/services/PricingService.ts:67-94 (handler)Handler function for historical_token_prices tool.
async (params) => { try { const response = await goldRushClient.PricingService.getTokenPrices( params.chainName as Chain, params.quoteCurrency as Quote, params.contractAddress, { from: params.from, to: params.to, pricesAtAsc: params.pricesAtAsc, } ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } } - src/services/PricingService.ts:34-66 (schema)Zod schema definition for historical_token_prices inputs.
{ chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), quoteCurrency: z .enum(Object.values(validQuoteValues) as [string, ...string[]]) .describe( "Currency to quote token prices in (e.g., 'USD', 'EUR'). This determines the currency for historical price data." ), contractAddress: z .string() .describe( "The token contract address to get historical prices for. Use the native token address for native token prices. Supports ENS, RNS, Lens Handle, and Unstoppable Domain resolution." ), from: z .string() .describe( "Start date for historical price data in YYYY-MM-DD format (e.g., '2023-01-01')." ), to: z .string() .describe( "End date for historical price data in YYYY-MM-DD format (e.g., '2023-12-31')." ), pricesAtAsc: z .boolean() .optional() .describe( "Sort prices in ascending chronological order. Default is false (descending order, newest first)." ), }, - src/services/PricingService.ts:28-33 (registration)Tool registration for historical_token_prices.
server.tool( "historical_token_prices", "Get the historical prices of one (or many) large cap ERC20 tokens between specified date ranges. Also supports native tokens.\n" + "Required: chainName (blockchain network), quoteCurrency (price currency), contractAddress (token contract), from (start date YYYY-MM-DD), to (end date YYYY-MM-DD).\n" + "Optional: pricesAtAsc (set to true for chronological ascending order, default is false for descending order).\n" + "Returns historical token prices for the specified time range.",