paradex_klines
Analyze historical price data for technical analysis and trading decisions. Calculate indicators, identify support/resistance levels, and backtest strategies using candlestick data.
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 handler function for the 'paradex_klines' tool. It fetches historical OHLCV (kline) data from the Paradex API using the provided market symbol, resolution, and time range. Parses the raw API response into a list of OHLCV Pydantic models.@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
- Input resolution type (KLinesResolutionEnum) and output schema (OHLCV model) for the paradex_klines tool.KLinesResolutionEnum = Literal[1, 3, 5, 15, 30, 60] class OHLCV(BaseModel): """OHLCV data for a market.""" timestamp: int open: float high: float low: float close: float volume: float
- src/mcp_paradex/tools/market.py:367-367 (registration)Registration of the paradex_klines tool using the FastMCP server decorator.@server.tool(name="paradex_klines")