Skip to main content
Glama
sv

MCP Paradex Server

by sv

paradex_orders_history

Retrieve historical order data from Paradex to analyze past trading activity, including filled, canceled, and expired orders.

Instructions

Get historical orders.

Retrieves the history of orders for the account, including filled, canceled, and expired orders. This is useful for analyzing past trading activity and performance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesFilter by market.
start_unix_msYesStart time in unix milliseconds.
end_unix_msYesEnd time in unix milliseconds.

Implementation Reference

  • The main execution handler for the 'paradex_orders_history' tool. Fetches historical order data from Paradex API within specified time range and market, validates with OrderState model, and returns structured results including schema.
    @server.tool(name="paradex_orders_history")
    async def get_orders_history(
        market_id: Annotated[str, Field(description="Filter by market.")],
        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:
        """
        Get historical orders.
    
        Retrieves the history of orders for the account, including filled, canceled, and expired orders.
        This is useful for analyzing past trading activity and performance.
        """
        client = await get_authenticated_paradex_client()
        params = {"market": market_id, "start_at": start_unix_ms, "end_at": end_unix_ms}
        # Remove None values from params
        params = {k: v for k, v in params.items() if v is not None}
        response = client.fetch_orders_history(params=params)
        if "error" in response:
            await ctx.error(response)
            raise Exception(response["error"])
        orders_raw: list[dict[str, Any]] = response["results"]
        orders = order_state_adapter.validate_python(orders_raw)
        result = {
            "description": OrderState.__doc__.strip() if OrderState.__doc__ else None,
            "fields": OrderState.model_json_schema(),
            "results": orders,
        }
        return result
  • Pydantic model 'OrderState' defining the structure and validation for individual order records returned in the tool's results. Used for input/output schema via model_json_schema().
    class OrderState(BaseModel):
        """Order state model representing the current state of an order on Paradex."""
    
        id: Annotated[str, Field(description="Unique order identifier generated by Paradex")]
        account: Annotated[str, Field(description="Paradex Account")]
        market: Annotated[str, Field(description="Market")]
        side: Annotated[str, Field(description="Order side")]
        type: Annotated[str, Field(description="Order type")]
        size: Annotated[float, Field(description="Order size")]
        remaining_size: Annotated[float, Field(description="Remaining size of the order")]
        price: Annotated[float, Field(description="Order price. 0 for MARKET orders")]
        status: Annotated[str, Field(description="Order status")]
        created_at: Annotated[int, Field(description="Order creation time")]
        last_updated_at: Annotated[
            int, Field(description="Order last update time. No changes once status=CLOSED")
        ]
        timestamp: Annotated[int, Field(description="Order signature timestamp")]
        cancel_reason: Annotated[
            str, Field(description="Reason for order cancellation if it was closed by cancel")
        ]
        client_id: Annotated[
            str, Field(description="Client order id provided by the client at order creation")
        ]
        seq_no: Annotated[
            int,
            Field(
                description="Unique increasing number that is assigned to this order update and changes on every order update"
            ),
        ]
        instruction: Annotated[str, Field(description="Execution instruction for order matching")]
        avg_fill_price: Annotated[str, Field(description="Average fill price of the order")]
        stp: Annotated[str, Field(description="Self Trade Prevention mode")]
        received_at: Annotated[
            int, Field(description="Timestamp in milliseconds when order was received by API service")
        ]
        published_at: Annotated[
            int, Field(description="Timestamp in milliseconds when order was sent to the client")
        ]
        flags: Annotated[list[str], Field(description="Order flags, allow flag: REDUCE_ONLY")]
        trigger_price: Annotated[str, Field(description="Trigger price for stop order")]
  • Schema mapping in 'get_filters_model' tool that provides the JSON schema for 'paradex_orders_history' output using OrderState.model_json_schema() for client-side validation/filtering.
    tool_descriptions = {
        "paradex_markets": models.MarketDetails.model_json_schema(),
        "paradex_market_summaries": models.MarketSummary.model_json_schema(),
        "paradex_open_orders": models.OrderState.model_json_schema(),
        "paradex_orders_history": models.OrderState.model_json_schema(),
        "paradex_vaults": models.Vault.model_json_schema(),
        "paradex_vault_summary": models.VaultSummary.model_json_schema(),
    }
    return tool_descriptions[tool_name]
  • TypeAdapter for list[OrderState] used in the handler to validate the raw API response into typed order list.
    order_state_adapter = TypeAdapter(list[OrderState])
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool retrieves historical orders but doesn't disclose behavioral traits like whether it requires authentication, has rate limits, returns paginated results, or what format the data comes in. For a read operation with no annotation coverage, this leaves significant gaps.

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 appropriately concise with three sentences that each add value: stating the purpose, specifying order types, and explaining usefulness. It's front-loaded with the core function and wastes no words, though it could be slightly more structured with explicit usage boundaries.

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 moderate complexity (historical data retrieval with three required parameters), no annotations, and no output schema, the description is minimally adequate. It covers what the tool does but lacks details about authentication requirements, response format, pagination, or error handling that would be needed for full contextual understanding.

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 their descriptions. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score when schema does the heavy lifting.

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

Purpose4/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 as 'Get historical orders' and specifies it retrieves order history including filled, canceled, and expired orders. It distinguishes itself from sibling tools like paradex_open_orders (current orders) and paradex_account_fills (executed trades), though it doesn't explicitly name these alternatives.

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

Usage Guidelines3/5

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

The description implies usage for analyzing past trading activity and performance, suggesting when this tool is appropriate. However, it doesn't provide explicit guidance on when to use this versus alternatives like paradex_account_fills or paradex_open_orders, nor does it mention any prerequisites or exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sv/mcp-paradex-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server