Skip to main content
Glama
kukapay

aster-info-mcp

get_recent_trades

Fetch recent trades data for cryptocurrency pairs and display results in a Markdown table format.

Instructions

Fetch recent trades data from Aster Finance API and return as Markdown table text.

Parameters:
    symbol (str): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
    limit (Optional[int]): Number of trades to return (1 to 1000). If None, defaults to 500.

Returns:
    str: Markdown table containing tradeId, price, qty, quoteQty, time, and isBuyerMaker.

Raises:
    Exception: If the API request fails or data processing encounters an error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
limitNo

Implementation Reference

  • main.py:627-685 (handler)
    The handler function for the 'get_recent_trades' tool. It fetches recent trade data from the Aster Finance API (/fapi/v1/trades endpoint), processes it using pandas into a formatted Markdown table showing trade ID, price, quantity, quote quantity, time, and whether the buyer was the maker.
    async def get_recent_trades(
        symbol: str,
        limit: Optional[int] = None
    ) -> str:
        """
        Fetch recent trades data from Aster Finance API and return as Markdown table text.
        
        Parameters:
            symbol (str): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
            limit (Optional[int]): Number of trades to return (1 to 1000). If None, defaults to 500.
        
        Returns:
            str: Markdown table containing tradeId, price, qty, quoteQty, time, and isBuyerMaker.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
        endpoint = "/fapi/v1/trades"
        
        # Construct query parameters
        params = {
            "symbol": symbol.upper(),  # Ensure symbol is uppercase (e.g., BTCUSDT)
        }
        if limit is not None:
            params["limit"] = limit
    
        async with httpx.AsyncClient() as client:
            try:
                # Make GET request to the API
                response = await client.get(f"{BASE_URL}{endpoint}", params=params)
                response.raise_for_status()  # Raise exception for 4xx/5xx errors
                
                # Parse JSON response
                trades_data = response.json()
                
                # Create pandas DataFrame
                df = pd.DataFrame(trades_data)
                
                # Convert time to readable format
                df["time"] = pd.to_datetime(df["time"], unit="ms")
                
                # Select relevant columns and format numbers
                df = df[["id", "price", "qty", "quoteQty", "time", "isBuyerMaker"]]
                df = df.rename(columns={"id": "tradeId"})  # Rename id to tradeId for clarity
                df["price"] = df["price"].astype(float).round(8)
                df["qty"] = df["qty"].astype(float).round(8)
                df["quoteQty"] = df["quoteQty"].astype(float).round(8)
                
                # Convert DataFrame to Markdown table
                markdown_table = df.to_markdown(index=False)
                
                return markdown_table
            
            except httpx.HTTPStatusError as e:
                # Handle HTTP errors (e.g., 400, 429)
                raise Exception(f"API request failed: {e.response.status_code} - {e.response.text}")
            except Exception as e:
                # Handle other errors (e.g., network issues, pandas errors)
                raise Exception(f"Error processing recent trades data: {str(e)}")
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behaviors: it specifies the return format (Markdown table), error handling ('Raises: Exception'), and API constraints (case-insensitive symbol, limit range 1-1000, default 500). However, it doesn't mention rate limits, authentication needs, or data freshness.

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

Conciseness5/5

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

The description is efficiently structured with clear sections (purpose, parameters, returns, raises), uses bullet-like formatting without markdown, and every sentence adds value. It's front-loaded with the core purpose and avoids redundancy.

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 no annotations, no output schema, and 2 parameters, the description is mostly complete: it covers purpose, parameters, returns, and errors. However, it lacks details on authentication, rate limits, or pagination, which are relevant for API tools. The absence of an output schema is compensated by describing the return format.

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

Parameters5/5

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

The description adds significant value beyond the schema, which has 0% coverage. It explains both parameters thoroughly: symbol meaning ('Trading pair symbol'), examples ('BTCUSDT', 'ETHUSDT'), and case-insensitivity; limit meaning ('Number of trades to return'), range ('1 to 1000'), default behavior ('If None, defaults to 500'), and optionality.

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 specific action ('Fetch recent trades data'), source ('from Aster Finance API'), and output format ('return as Markdown table text'). It distinguishes this tool from siblings like get_aggregated_trades or get_order_book by focusing on raw trade data rather than aggregated or order book information.

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 through parameter explanations (e.g., 'Trading pair symbol'), but lacks explicit guidance on when to use this tool versus alternatives like get_aggregated_trades. It mentions the API source but doesn't specify scenarios where recent trades are preferred over other data types.

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/kukapay/aster-info-mcp'

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