Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_trades

Analyze market transactions to detect large trades, calculate average trade sizes, identify buy/sell imbalances, and monitor execution prices versus order book data for market sentiment and liquidity insights.

Instructions

Analyze actual market transactions to understand market sentiment and liquidity.

Use this tool when you need to:
- Detect large trades that might signal institutional activity
- Calculate average trade size during specific periods
- Identify buy/sell pressure imbalances
- Monitor execution prices vs. order book prices
- Understand market momentum through trade flow

Trade data provides insights into actual market activity versus just orders,
helping you understand how other participants are behaving.

Example use cases:
- Detecting large "whale" transactions that might influence price
- Analyzing trade sizes to gauge market participation
- Identifying periods of aggressive buying or selling
- Understanding trade frequency as an indicator of market interest
- Comparing executed prices to orderbook mid-price for market impact analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesMarket symbol to get trades for.
start_unix_msYesStart time in unix milliseconds.
end_unix_msYesEnd time in unix milliseconds.

Implementation Reference

  • The main handler function for the 'paradex_trades' tool. It fetches recent trades for a specified market and time range using the Paradex client, validates them using the Trade model, and returns a structured response including schema information.
    @server.tool(name="paradex_trades")
    async def get_trades(
        market_id: Annotated[str, Field(description="Market symbol to get trades for.")],
        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,
    ) -> dict:
        """
        Analyze actual market transactions to understand market sentiment and liquidity.
    
        Use this tool when you need to:
        - Detect large trades that might signal institutional activity
        - Calculate average trade size during specific periods
        - Identify buy/sell pressure imbalances
        - Monitor execution prices vs. order book prices
        - Understand market momentum through trade flow
    
        Trade data provides insights into actual market activity versus just orders,
        helping you understand how other participants are behaving.
    
        Example use cases:
        - Detecting large "whale" transactions that might influence price
        - Analyzing trade sizes to gauge market participation
        - Identifying periods of aggressive buying or selling
        - Understanding trade frequency as an indicator of market interest
        - Comparing executed prices to orderbook mid-price for market impact analysis
        """
        try:
            # Get trades from Paradex
            client = await get_paradex_client()
            response = client.fetch_trades(
                params={"market": market_id, "start_at": start_unix_ms, "end_at": end_unix_ms}
            )
            if "error" in response:
                raise Exception(response["error"])
            trades = trade_adapter.validate_python(response["results"])
            results = {
                "description": Trade.__doc__.strip() if Trade.__doc__ else None,
                "fields": Trade.model_json_schema(),
                "results": trades,
            }
            return results
        except Exception as e:
            await ctx.error(f"Error fetching trades for {market_id}: {e!s}")
            raise e
  • Pydantic model defining the structure of individual trade objects returned in the tool's response. Used for validation and schema generation.
    class Trade(BaseModel):
        """Trade model representing a completed trade on Paradex."""
    
        id: Annotated[str, Field(description="Unique Trade ID per TradeType")]
        market: Annotated[str, Field(description="Market for which trade was done")]
        side: Annotated[str, Field(description="Taker side")]
        size: Annotated[float, Field(description="Trade size")]
        price: Annotated[float, Field(description="Trade price")]
        created_at: Annotated[
            int, Field(description="Unix Millisecond timestamp at which trade was done")
        ]
        trade_type: Annotated[str, Field(description="Trade type, can be FILL or LIQUIDATION")]
  • The @server.tool decorator registers the 'paradex_trades' tool with the MCP server.
    @server.tool(name="paradex_trades")
  • TypeAdapter for validating lists of Trade objects returned by the Paradex API.
    trade_adapter = TypeAdapter(list[Trade])

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the tool's analytical purpose and use cases but lacks behavioral details like rate limits, authentication requirements, error conditions, or response format. While it mentions what the tool helps achieve (e.g., 'understand market momentum'), it doesn't disclose operational traits such as data freshness, pagination, or performance characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections: purpose statement, usage guidelines, explanatory note, and example use cases. It is appropriately sized and front-loaded, starting with the core purpose. Some redundancy exists (e.g., 'Detect large trades' appears in both guidelines and examples), but overall, sentences earn their place by adding value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's analytical complexity and lack of annotations or output schema, the description is moderately complete. It thoroughly explains when and why to use the tool but omits behavioral and output details. For a tool with no structured output schema, the description should ideally hint at return values (e.g., trade lists, metrics), but it focuses on use cases instead, leaving gaps in operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters (market_id, start_unix_ms, end_unix_ms) with descriptions. The description adds no parameter-specific information beyond what the schema provides. It focuses on the tool's purpose and usage, not parameter semantics, meeting the baseline of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Analyze actual market transactions to understand market sentiment and liquidity.' It specifies the verb 'analyze' and resource 'market transactions' (trades), distinguishing it from sibling tools like paradex_orderbook (orders) or paradex_account_fills (user-specific fills). The description explicitly contrasts trade data with 'just orders,' highlighting its unique analytical focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidelines with a bulleted list of when to use this tool: 'Detect large trades...', 'Calculate average trade size...', 'Identify buy/sell pressure imbalances...', etc. It distinguishes this tool from alternatives by noting trade data provides insights 'versus just orders,' helping the agent choose between this and order-related siblings like paradex_orderbook or paradex_orders_history.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.