cancelOrder action enables Vincent Apps to cancel a specific open order on Hyperliquid’s spot or perpetuals market.
Prerequisites
Before executing thecancelOrder action, the following conditions must be met:
- Open Order: There must be an open order with the specified order ID that belongs to the Vincent User Agent Wallet.
- Order Details: You must provide the symbol (trading pair for spot or asset for perp) and the order ID to cancel.
To learn more about executing Vincent Abilities, see the Executing
Abilities guide.
Executing the precheck Function
The precheck function validates some prerequisites for executing a cancel order, without actually performing the operation.
For the cancelOrder action, the precheck function will validate the following:
- Order with provided order ID must exist and be open.
- Parameters
- Implementation
- Response
The
precheck function requires the following parameters:Executing the execute Function
The execute function performs the actual cancel operation, removing the specified order from Hyperliquid.
For the cancelOrder action, the execute function will:
- Cancel the specified order on Hyperliquid.
- Return the cancellation result from Hyperliquid.
- Parameters
- Implementation
- Response
The
execute function requires the following parameters:The
arbitrumRpcUrl parameter is not required for the execute function, only for precheck.Important Considerations
Finding Order IDs
Finding Order IDs
To cancel an order, you need its order ID (
oid). You can find order IDs by:- Querying open orders using the Hyperliquid API
- Checking the order result when placing orders (the
oidis returned in the response) - Using a [Hyperliquid SDK](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api to fetch open orders
Symbol Format
Symbol Format
The symbol format differs between spot and perpetual orders:
- Spot orders: Use trading pair format (e.g., “PURR/USDC”, “ETH/USDC”)
- Perp orders: Use base asset only (e.g., “SOL”, “ETH”, “BTC”)
Order Must Exist
Order Must Exist
The order must be an open order that:
- Belongs to the Vincent User’s Agent Wallet
- Has not already been filled, cancelled, or expired
- Is for the specified symbol
Verifying Cancellation Success
Verifying Cancellation Success
After the cancellation is executed, you can verify it was successful by:
- Checking the open orders list using the Hyperliquid API
- Confirming the order ID no longer appears in the list
- Reviewing the cancellation result response
Reference Implementation
For a complete working example showing the full cancel order workflow including verification, see the cancel-order.spec.ts end-to-end test in theability-hyperliquid package.

