cancel_order
Cancel an open order on Hyperliquid exchange by specifying the market symbol and order ID to manage trading positions.
Instructions
Cancel an open order by order ID
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"symbol": "<symbol>",
"order_id": "<order_id>"
},
"name": "cancel_order"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Market symbol | |
| order_id | Yes | Order ID to cancel |
Implementation Reference
- src/hyperliquid_mcp/client.py:160-164 (handler)Main handler implementation of cancel_order. Calls the Hyperliquid exchange API to cancel an order by symbol and order_id.
def cancel_order(self, symbol: str, order_id: int) -> dict[str, Any]: """Cancel an open order.""" exchange = self._require_exchange() result = exchange.cancel(symbol.upper(), order_id) return {"status": "cancelled", "result": result} - src/hyperliquid_mcp/server.py:154-155 (handler)Dispatch handler that routes the 'cancel_order' tool call to the client method, extracting symbol and order_id from arguments.
case "cancel_order": return client.cancel_order(args["symbol"], args["order_id"]) - src/hyperliquid_mcp/server.py:81-92 (registration)Tool registration for 'cancel_order' with name, description, and input schema defining required parameters (symbol and order_id).
Tool( name="cancel_order", description="Cancel an open order by order ID", inputSchema={ "type": "object", "properties": { "symbol": {"type": "string", "description": "Market symbol"}, "order_id": {"type": "integer", "description": "Order ID to cancel"}, }, "required": ["symbol", "order_id"], }, ),