get_price_history
Retrieve historical price data for any token by specifying address, time range, and interval. Analyze token performance or simulate trading scenarios effectively using this tool on the Trading Simulator MCP Server.
Instructions
Get historical price data for a token
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Optional blockchain type | |
| endTime | No | End time as ISO timestamp | |
| interval | No | Time interval for price points | |
| specificChain | No | Optional specific chain for EVM tokens | |
| startTime | No | Start time as ISO timestamp | |
| token | Yes | Token address |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"chain": {
"description": "Optional blockchain type",
"enum": [
"svm",
"evm"
],
"type": "string"
},
"endTime": {
"description": "End time as ISO timestamp",
"type": "string"
},
"interval": {
"description": "Time interval for price points",
"enum": [
"1m",
"5m",
"15m",
"1h",
"4h",
"1d"
],
"type": "string"
},
"specificChain": {
"description": "Optional specific chain for EVM tokens",
"enum": [
"eth",
"polygon",
"bsc",
"arbitrum",
"base",
"optimism",
"avalanche",
"linea",
"svm"
],
"type": "string"
},
"startTime": {
"description": "Start time as ISO timestamp",
"type": "string"
},
"token": {
"description": "Token address",
"type": "string"
}
},
"required": [
"token"
],
"type": "object"
}
Implementation Reference
- src/index.ts:212-250 (schema)Input schema and tool definition (registration) for get_price_history tool.{ name: "get_price_history", description: "Get historical price data for a token", inputSchema: { type: "object", properties: { token: { type: "string", description: "Token address" }, startTime: { type: "string", description: "Start time as ISO timestamp" }, endTime: { type: "string", description: "End time as ISO timestamp" }, interval: { type: "string", enum: ["1m", "5m", "15m", "1h", "4h", "1d"], description: "Time interval for price points" }, chain: { type: "string", enum: ["svm", "evm"], description: "Optional blockchain type" }, specificChain: { type: "string", enum: ["eth", "polygon", "bsc", "arbitrum", "base", "optimism", "avalanche", "linea", "svm"], description: "Optional specific chain for EVM tokens" } }, required: ["token"], additionalProperties: false, $schema: "http://json-schema.org/draft-07/schema#" } },
- src/index.ts:527-547 (handler)Handler logic for executing the get_price_history tool: validates arguments, builds PriceHistoryParams, calls tradingClient.getPriceHistory(), and returns response.case "get_price_history": { if (!args || typeof args !== "object" || !("token" in args)) { throw new Error("Invalid arguments for get_price_history"); } const historyParams: PriceHistoryParams = { token: args.token as string }; if ("startTime" in args) historyParams.startTime = args.startTime as string; if ("endTime" in args) historyParams.endTime = args.endTime as string; if ("interval" in args) historyParams.interval = args.interval as PriceHistoryParams['interval']; if ("chain" in args) historyParams.chain = args.chain as BlockchainType; if ("specificChain" in args) historyParams.specificChain = args.specificChain as SpecificChain; const response = await tradingClient.getPriceHistory(historyParams); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], isError: false }; }
- src/types.ts:91-99 (schema)TypeScript interface defining the parameters for get_price_history (PriceHistoryParams).// Price History Parameters export interface PriceHistoryParams { token: string; startTime?: string; endTime?: string; interval?: '1m' | '5m' | '15m' | '1h' | '4h' | '1d'; chain?: BlockchainType; specificChain?: SpecificChain; }
- src/types.ts:220-226 (schema)TypeScript interface defining the expected response structure for get_price_history (PriceHistoryResponse).export interface PriceHistoryResponse extends ApiResponse { token: string; chain: BlockchainType; specificChain: SpecificChain | null; interval: string; history: PriceHistoryPoint[]; }
- src/index.ts:411-415 (registration)Registration of all tools including get_price_history via the ListToolsRequestSchema handler, which returns the TRADING_SIM_TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TRADING_SIM_TOOLS }; });