get_user_funding_history
Retrieve funding payment history for a Hyperliquid account within specified date ranges to track payment records and amounts.
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
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes | ||
| start_time | Yes | ||
| end_time | Yes |
Input Schema (JSON Schema)
{
"properties": {
"account_address": {
"title": "Account Address",
"type": "string"
},
"end_time": {
"title": "End Time",
"type": "string"
},
"start_time": {
"title": "Start Time",
"type": "string"
}
},
"required": [
"account_address",
"start_time",
"end_time"
],
"type": "object"
}
Implementation Reference
- main.py:148-170 (handler)The handler function implementing the 'get_user_funding_history' tool. It converts ISO timestamps to milliseconds and calls the Hyperliquid SDK's info.user_funding_history method to retrieve the user's funding payment history, returning it as JSON or an error message.@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:393-393 (helper)A supporting prompt message in the 'analyze_positions' function that instructs the assistant to use the 'get_user_funding_history' tool among others for analyzing user positions.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."),