Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_bbo

Retrieve current best bid and ask prices for immediate trading decisions, spread calculations, and real-time market condition monitoring.

Instructions

Get the current best available prices for immediate execution decisions.

Use this tool when you need to:
- Make quick trading decisions without full orderbook depth
- Calculate current spread costs before placing orders
- Monitor real-time price changes efficiently
- Get a snapshot of current market conditions
- Determine fair mid-price for calculations

The BBO provides the most essential price information with minimal data,
perfect for quick decisions or when full orderbook depth isn't needed.

Example use cases:
- Calculating current trading spreads before placing orders
- Monitoring real-time price movements efficiently
- Determining execution prices for immediate market orders
- Calculating mid-price for order placement strategies
- Setting appropriate limit order prices to improve fill chances

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesMarket symbol to get BBO for.

Implementation Reference

  • Handler function for paradex_bbo tool. Fetches BBO data from Paradex client, validates with BBO model, and formats response with schema.
    @server.tool(name="paradex_bbo")
    async def get_bbo(
        market_id: Annotated[str, Field(description="Market symbol to get BBO for.")],
        ctx: Context = None,
    ) -> dict:
        """
        Get the current best available prices for immediate execution decisions.
    
        Use this tool when you need to:
        - Make quick trading decisions without full orderbook depth
        - Calculate current spread costs before placing orders
        - Monitor real-time price changes efficiently
        - Get a snapshot of current market conditions
        - Determine fair mid-price for calculations
    
        The BBO provides the most essential price information with minimal data,
        perfect for quick decisions or when full orderbook depth isn't needed.
    
        Example use cases:
        - Calculating current trading spreads before placing orders
        - Monitoring real-time price movements efficiently
        - Determining execution prices for immediate market orders
        - Calculating mid-price for order placement strategies
        - Setting appropriate limit order prices to improve fill chances
        """
        try:
            # Get BBO from Paradex
            client = await get_paradex_client()
            response = client.fetch_bbo(market_id)
            bbo = BBO(**response)
            results = {
                "description": BBO.__doc__.strip() if BBO.__doc__ else None,
                "fields": BBO.model_json_schema(),
                "results": bbo,
            }
            return results
        except Exception as e:
            await ctx.error(f"Error fetching BBO for {market_id}: {e!s}")
            raise e
  • Pydantic model defining the input/output schema for BBO data used by the paradex_bbo tool.
    class BBO(BaseModel):
        """Best Bid and Offer model for a market."""
    
        market: Annotated[str, Field(description="Symbol of the market")]
        seq_no: Annotated[int, Field(description="Sequence number of the orderbook")]
        ask: Annotated[float, Field(description="Best ask price")]
        ask_size: Annotated[float, Field(description="Best ask size")]
        bid: Annotated[float, Field(description="Best bid price")]
        bid_size: Annotated[float, Field(description="Best bid size")]
        last_updated_at: Annotated[
            int, Field(description="Last update to the orderbook in milliseconds")
        ]
  • Registration of the paradex_bbo tool using the @server.tool decorator.
    @server.tool(name="paradex_bbo")

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/Habinar/mcp-paradex-py'

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