Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_funding_data

Analyze perpetual futures funding rates to calculate position costs, identify arbitrage opportunities, and understand historical patterns for trading decisions.

Instructions

Analyze funding rates for potential funding arbitrage or to understand holding costs.

Use this tool when you need to:
- Calculate expected funding payments for a position
- Find markets with extreme funding rates for potential arbitrage
- Understand historical funding patterns for a market
- Evaluate the cost of holding a position over time

This data is critical for perpetual futures traders to assess the carrying cost
of positions and identify potential funding arbitrage opportunities.

Example use cases:
- Finding markets with negative funding for "paid to hold" opportunities
- Calculating the funding component of a trade's P&L
- Comparing funding rates across different assets for relative value trades
- Analyzing funding rate volatility to predict potential rate changes

Input Schema

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main tool handler function that fetches and returns funding data for a specified market over a time range using the Paradex API client. Includes input parameter definitions and output formatting with schema.
    @server.tool(name="paradex_funding_data")
    async def get_funding_data(
        market_id: Annotated[str, Field(description="Market symbol to get funding data 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[str, Any]:
        """
        Analyze funding rates for potential funding arbitrage or to understand holding costs.
    
        Use this tool when you need to:
        - Calculate expected funding payments for a position
        - Find markets with extreme funding rates for potential arbitrage
        - Understand historical funding patterns for a market
        - Evaluate the cost of holding a position over time
    
        This data is critical for perpetual futures traders to assess the carrying cost
        of positions and identify potential funding arbitrage opportunities.
    
        Example use cases:
        - Finding markets with negative funding for "paid to hold" opportunities
        - Calculating the funding component of a trade's P&L
        - Comparing funding rates across different assets for relative value trades
        - Analyzing funding rate volatility to predict potential rate changes
        """
        try:
            # Get funding data from Paradex
            client = await get_paradex_client()
            response = client.fetch_funding_data(
                params={"market": market_id, "start_at": start_unix_ms, "end_at": end_unix_ms}
            )
            if "error" in response:
                await ctx.error(response)
                raise Exception(response["error"])
            funding_data = funding_data_adapter.validate_python(response["results"])
            results = {
                "description": FundingData.__doc__.strip() if FundingData.__doc__ else None,
                "fields": FundingData.model_json_schema(),
                "results": funding_data,
            }
            return results
        except Exception as e:
            await ctx.error(f"Error fetching funding data for {market_id}: {e!s}")
            raise e
  • Pydantic BaseModel defining the structure and fields for FundingData used in the tool's output validation and schema description.
    class FundingData(BaseModel):
        """
        Model representing funding data for a perpetual market.
        https://docs.paradex.trade/documentation/risk-system/funding-mechanism
        """
    
        market: Annotated[str, Field(description="Market represents the market identifier")]
        created_at: Annotated[
            int, Field(description="Timestamp in milliseconds when the funding data was calculated")
        ]
        funding_index: Annotated[
            str,
            Field(
                description="Funding Index is accrued funding for 1 unit of the asset since market launchs and is calculated as a time-weighted sum of the Funding Premium. This value expressed in the settlement asset of the instrument (USDC)"
            ),
        ]
        funding_premium: Annotated[
            str,
            Field(
                description="Funding Premium represents the 8h amount paid by long positions to short positions. This value expressed in the settlement asset of the instrument (USDC)"
            ),
        ]
        funding_rate: Annotated[
            str,
            Field(
                description="Clamped [mark price]/[spot price] - 1. Full details - https://docs.paradex.trade/documentation/risk-system/funding-mechanism#funding-rate"
            ),
        ]
  • The @server.tool decorator that registers the paradex_funding_data tool with the MCP server.
    @server.tool(name="paradex_funding_data")

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "title": "get_funding_dataDictOutput",
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.1/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 mentions that the data is 'critical for perpetual futures traders' and discusses use cases, but doesn't disclose behavioral traits like rate limits, authentication requirements, data freshness, or error conditions. The description adds context about what the tool helps with but lacks operational details.

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, importance context, and example use cases. It's appropriately sized at 10 sentences, though some redundancy exists between the usage guidelines and example use cases. Every sentence adds value, but it could be slightly more concise.

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

Completeness4/5

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

Given the tool's complexity (financial data analysis with 3 parameters) and the presence of an output schema, the description provides good context about what the tool does and when to use it. It covers purpose, usage scenarios, and practical applications. With output schema handling return values, the main gap is lack of behavioral transparency details.

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). The description doesn't add any parameter-specific information beyond what's in the schema, such as format examples for market_id or time range constraints. This meets 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 as analyzing funding rates for funding arbitrage and understanding holding costs. It specifies the verb 'analyze' and resource 'funding rates', distinguishing it from sibling tools like paradex_account_funding_payments (which likely shows actual payments) and paradex_account_positions (which shows current positions).

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 four specific scenarios when to use this tool, including calculating expected payments, finding extreme rates, understanding historical patterns, and evaluating holding costs. It also includes example use cases that reinforce when this tool is appropriate versus alternatives.

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