get_batch_historical_prices
Retrieve historical price data for multiple cryptocurrencies at specific timestamps using batch queries. This tool helps analyze token price movements across different time periods for research and trading decisions.
Instructions
GET /coins/batchHistorical
Get historical prices for multiple tokens at multiple different timestamps.
Parameters:
coins: dict where keys are coins in format {chain}:{address} and values are arrays of timestamps
search_width: time range on either side to find price data (default: '6h')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coins | Yes | ||
| search_width | No | 6h |
Implementation Reference
- defillama_server.py:641-659 (handler)The handler function for the 'get_batch_historical_prices' MCP tool. It is registered using the @mcp.tool() decorator and implements the logic to fetch batch historical prices from the DefiLlama API endpoint '/coins/batchHistorical' using the shared make_request helper.@mcp.tool() async def get_batch_historical_prices( coins: Dict[str, List[int]], search_width: str = "6h" ) -> str: """GET /coins/batchHistorical Get historical prices for multiple tokens at multiple different timestamps. Parameters: coins: dict where keys are coins in format {chain}:{address} and values are arrays of timestamps search_width: time range on either side to find price data (default: '6h') """ params = { 'coins': str(coins), 'searchWidth': search_width } result = await make_request('GET', '/coins/batchHistorical', params) return str(result)