get_latest_trading_volume_by_aggregator
Retrieve trading volume data by aggregator for the past 24 hours and 7 days. Returns a markdown-formatted table to analyze DEX metrics or an error message if the query fails.
Instructions
Retrieve the latest 24-hour and 7-day trading volume by aggregator.
Args:
limit (int, optional): Maximum number of rows to retrieve from the query. Defaults to 1000.
Returns:
str: A markdown-formatted table of trading volume data, or an error message if the query fails.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- main.py:65-83 (handler)The handler function for the 'get_latest_trading_volume_by_aggregator' tool. It fetches data from Dune Analytics query ID 21689 using the helper function, processes it into a ranked DataFrame with pandas, and returns a markdown table or error message.@mcp.tool() def get_latest_trading_volume_by_aggregator(limit: int = 1000) -> str: """ Retrieve the latest 24-hour and 7-day trading volume by aggregator. Args: limit (int, optional): Maximum number of rows to retrieve from the query. Defaults to 1000. Returns: str: A markdown-formatted table of trading volume data, or an error message if the query fails. """ try: data = get_latest_result(21689, limit=limit) df = pd.DataFrame(data) df = df.set_index("Rank") df = df.sort_index(ascending=True) return df.to_markdown() except Exception as e: return str(e)