paradex_klines
Analyze historical price data for technical analysis, calculate indicators, identify support/resistance levels, and backtest trading strategies.
Instructions
Analyze historical price patterns for technical analysis and trading decisions.
Use this tool when you need to:
- Perform technical analysis on historical price data
- Identify support and resistance levels from price history
- Calculate indicators like moving averages, RSI, or MACD
- Backtest trading strategies on historical data
- Visualize price action over specific timeframes
Candlestick data is fundamental for most technical analysis and trading decisions,
providing structured price and volume information over time.
Example use cases:
- Identifying chart patterns for potential entries or exits
- Calculating technical indicators for trading signals
- Determining volatility by analyzing price ranges
- Finding significant price levels from historical support/resistance
- Measuring volume patterns to confirm price movements
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market_id | Yes | Market symbol to get klines for. | |
| resolution | No | The time resolution of the klines. | |
| start_unix_ms | Yes | Start time in unix milliseconds. | |
| end_unix_ms | Yes | End time in unix milliseconds. |
Implementation Reference
- src/mcp_paradex/tools/market.py:367-427 (handler)The main execution logic for the paradex_klines tool. Fetches historical kline (OHLCV) data from the Paradex API for a given market, resolution, and time range, parses the raw response into OHLCV objects, and returns the list.@server.tool(name="paradex_klines") async def get_klines( market_id: Annotated[str, Field(description="Market symbol to get klines for.")], resolution: Annotated[ KLinesResolutionEnum, Field(default=1, description="The time resolution of the klines.") ], start_unix_ms: Annotated[int, Field(description="Start time in unix milliseconds.")], end_unix_ms: Annotated[int, Field(description="End time in unix milliseconds.")], ctx: Context = None, ) -> list[OHLCV]: """ Analyze historical price patterns for technical analysis and trading decisions. Use this tool when you need to: - Perform technical analysis on historical price data - Identify support and resistance levels from price history - Calculate indicators like moving averages, RSI, or MACD - Backtest trading strategies on historical data - Visualize price action over specific timeframes Candlestick data is fundamental for most technical analysis and trading decisions, providing structured price and volume information over time. Example use cases: - Identifying chart patterns for potential entries or exits - Calculating technical indicators for trading signals - Determining volatility by analyzing price ranges - Finding significant price levels from historical support/resistance - Measuring volume patterns to confirm price movements """ try: # Get klines from Paradex client = await get_paradex_client() response = await api_call( client, "markets/klines", params={ "symbol": market_id, "resolution": str(resolution), "start_at": start_unix_ms, "end_at": end_unix_ms, }, ) if "error" in response: raise Exception(response["error"]) results = response["results"] list_of_ohlcv = [ OHLCV( timestamp=result[0], open=result[1], high=result[2], low=result[3], close=result[4], volume=result[5], ) for result in results ] return list_of_ohlcv except Exception as e: await ctx.error(f"Error fetching klines for {market_id}: {e!s}") raise e
- Pydantic model defining the output schema for each kline data point returned by the tool.class OHLCV(BaseModel): """OHLCV data for a market.""" timestamp: int open: float high: float low: float close: float volume: float
- Type definition for the resolution parameter (timeframe in minutes: 1,3,5,15,30,60).KLinesResolutionEnum = Literal[1, 3, 5, 15, 30, 60]
- src/mcp_paradex/tools/market.py:367-367 (registration)Tool registration decorator that registers the get_klines function as the MCP tool named paradex_klines.@server.tool(name="paradex_klines")