Hyperliquid Close Position
Close an open perpetual position on Hyperliquid by placing a reduce-only IOC order at market price with slippage. Automatically determines side and size from current position. Ideal for: stop-loss execution, taking profits, and emergency position exits.
Catalog action Hyperliquid wallet
Close an open perpetual position on Hyperliquid by placing a reduce-only IOC order at market price with slippage. Automatically determines side and size from current position. Ideal for: stop-loss execution, taking profits, and emergency position exits.
This action can require a wallet connector, gas, token movement, or an external side effect. Test with simulation or a controlled amount before using it in a live workflow.
At a Glance
| Field | Value |
|---|---|
| Action ID | hyperliquid-close-position |
| Category | Hyperliquid |
| Connector | wallet |
| Requires gas | No |
| Funds movement | None declared |
| Tags | hyperliquid, perps, position, trade, trading |
Payload Schema
| Field | Type | Required | Description |
|---|---|---|---|
dex | string | No | HIP-3 DEX name for TradFi markets. Omit for standard crypto perps. xyz = trade.xyz (stocks, indices, commodities), flx = flx.finance, vntl = vntl.exchange |
coin | string | Yes | Asset symbol to close position for (e.g., BTC, ETH for crypto; TSLA, SP500 for HIP-3 DEX) |
slippageBps | number | No | Slippage tolerance in basis points (default 100 = 1%). Price is adjusted from mid to ensure fill. |
Result Schema
| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | Close outcome |
coin | string | No | Asset symbol |
closedSize | string | No | Size that was closed |
avgPrice | string | No | Average fill price |
side | string | No | Side of the closing order (buy to close short, sell to close long) |
oid | number | No | Hyperliquid order ID |
Examples
json{ "type": "hyperliquid-close-position", "payload": { "coin": "example-coin" }, "children": [], "connector": { "type": "wallet", "id": "conn_wallet" }}
bashcurl -X POST "https://api.b3os.org/v1/actions/hyperliquid-close-position/test" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "coin": "example-coin" }}'
Payload fields can use workflow expressions such as {{$trigger.body.amount}}, {{$nodes.fetch.result.price}}, and {{$props.asset}} when the value should come from a trigger, prior node, or reusable workflow prop.
