hyperliquid-positions

Manage Hyperliquid perp positions, leverage, margin, and reduce-only closes via exchange API.

Updated Sep 7, 2026
One-click install
npx skills add https://github.com/swcstudiospace/hypergrok-autonomous-desk --skill hyperliquid-positions-swcstudiospace
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hyperliquid-positions
Source: https://github.com/swcstudiospace/hypergrok-autonomous-desk/tree/main/skills/hyperliquid-positions
Command: npx skills add https://github.com/swcstudiospace/hypergrok-autonomous-desk --skill hyperliquid-positions-swcstudiospace

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing perpetual futures positions on Hyperliquid requires precise handling of leverage settings, margin modes, liquidation risk, and order cleanup, and mistakes like orphaned stop orders or wrong close types can cause real losses. ## Core Features & Use Cases - Position and Margin Reads: Query clearinghouseState for open positions, margin usage, liquidation prices, and per-market margin tiers via the Hyperliquid info API. - Leverage and Margin Writes: Set cross or isolated leverage per market and add isolated margin, gated through desk_send.py with a Risk PASS and policy-gate approval. - Safe Position Closes: Close positions with reduce-only IOC orders at slippage-bounded prices, then clean up orphaned TP/SL orders only after confirming a full close. - Use Case: A Risk Manager agent checks every open position for a resting reduce-only trigger order using frontendOpenOrders, reports unprotected positions to the Desk Lead, and the Execution Trader closes an ETH long at a 30 bps slippage bound. ## Quick Start Ask the agent to read my current Hyperliquid positions and margin usage on testnet and report each position's liquidation distance and protection status.

Frequently Asked Questions about hyperliquid-positions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I close a Hyperliquid perp position safely?▼

Close a Hyperliquid position by sending a reduce-only IOC limit order in the opposite direction at a slippage-bounded price, reading the live size from clearinghouseState seconds before sending. Afterward, confirm whether the close was full or partial before cancelling any TP/SL orders.

How do I check if a Hyperliquid position has stop-loss protection?▼

Query frontendOpenOrders and look for a reduce-only trigger order on the opposite side of the position, either sized at least to the position or position-tied with isPositionTpsl set to true. Missing or undersized triggers mean the position is unprotected.

What is the difference between cross and isolated margin on Hyperliquid?▼

Cross margin shares the account's margin across all positions with account-wide liquidation, while isolated margin confines risk to the position's own margin, which you can add to or remove from. Some markets are strictIsolated or noCross and restrict these modes.

Why does max leverage differ from the headline value on Hyperliquid?▼

Max leverage is tiered by position notional: each market has a margin table listing notional thresholds with lower max leverage above each tier. Read the applicable tier from meta.marginTables rather than assuming the headline maxLeverage applies to your size.

Can I change leverage on an open Hyperliquid position?▼

Yes, leverage on an existing position can be raised without closing it, which frees margin and moves the isolated liquidation price; lowering it requires enough free margin to cover the higher initial margin. Always inform the user because margin usage changes immediately.