get_user_funding_history
Retrieve funding payment records for a Hyperliquid account within a specified time period to analyze payment history and track financial activity.
Instructions
Fetch the funding payment history for a specific user account.
Parameters:
account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d').
start_time (str): The start time for the funding history in ISO 8601 format (e.g., '2025-01-01T00:00:00Z').
end_time (str): The end time for the funding history in ISO 8601 format (e.g., '2025-12-31T23:59:59Z').
ctx (Context): The MCP context object for accessing server state.
Returns:
str: A JSON string containing a list of funding payment records, each with details such as amount and timestamp.
Returns a JSON string with an error message if the query fails.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes | ||
| start_time | Yes | ||
| end_time | Yes |
Implementation Reference
- main.py:148-170 (handler)The handler function implementing the 'get_user_funding_history' tool logic, including input parameter handling, timestamp conversion, API call to Hyperliquid SDK, JSON serialization, and error handling. Registered via @mcp.tool() decorator.@mcp.tool() async def get_user_funding_history(account_address: str, start_time: str, end_time: str, ctx: Context) -> str: """ Fetch the funding payment history for a specific user account. Parameters: account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d'). start_time (str): The start time for the funding history in ISO 8601 format (e.g., '2025-01-01T00:00:00Z'). end_time (str): The end time for the funding history in ISO 8601 format (e.g., '2025-12-31T23:59:59Z'). ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing a list of funding payment records, each with details such as amount and timestamp. Returns a JSON string with an error message if the query fails. """ try: start_ms = int(iso8601.parse_date(start_time).timestamp() * 1000) end_ms = int(iso8601.parse_date(end_time).timestamp() * 1000) data = info.user_funding_history(account_address, start_ms, end_ms) return json.dumps(data) except Exception as e: return json.dumps({"error": f"Failed to fetch user funding history: {str(e)}"})
- main.py:392-397 (helper)A prompt helper named 'analyze_positions' that instructs the use of the 'get_user_funding_history' tool among others for analyzing user trading positions.base.UserMessage(f"Please analyze the trading positions for account {account_address}:"), base.UserMessage("Use the get_user_state, get_user_open_orders, get_user_trade_history, get_user_funding_history, and get_user_fees tools to fetch data."), base.AssistantMessage( "I'll analyze the user's trading positions, open orders, trade history, funding payments, and fees to provide insights on risk and performance." ) ]