Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

HyperGrok Hyperliquid Positions

БесплатноБез исполняемых скриптовНе проверен

Manage Hyperliquid perp positions and margin from the desk computer - read positions and margin, set leverage and cross/isolated mode, add isolated margin…

galleonlabsот galleonlabs739 установок в других каталогах

Об этом скилле

Hyperliquid positions and margin

Reads here are for everyone (Risk Manager first); the write actions (updateLeverage, updateIsolatedMargin, closes) are Execution Trader only, on a ticket approved by id or covered by a valid standing mandate. A mandate covers closes and setting leverage to what the ticket needs; isolated-margin top-ups and margin-mode changes the ticket does not need stay per-ticket. Order mechanics are in hyperliquid-orders.

Concepts

  • Cross margin (default): all cross positions share the account's margin, and unrealised PnL counts as margin; liquidation is account-wide. Isolated margin: the position has its own margin; only that margin is at risk, and you can add to or remove from it (some markets are strictIsolated and refuse removal; HIP-3 markets may be noCross).
  • Leverage is set per market and per mode with updateLeverage; it caps position size against margin. Max leverage is per market and tiered by notional (see margin tiers).
  • Margin tiers: each perp has a margin table (meta.marginTables, matched to the asset via marginTableId) listing notional thresholds and the max leverage allowed above each. Bigger positions get less leverage.
  • Maintenance margin is half of the initial margin at the max leverage of the applicable tier (so between 1.25% for a 40x market and 16.7% for a 3x market); liquidation happens when account (cross) or position (isolated) equity falls below maintenance margin, on mark price. Positions above 100k USDC (10k on testnet) are liquidated 20% at a time first; the cross liquidation price does not depend on your leverage setting.
  • Liquidation price is reported by the exchange per position (liquidationPx); use that, do not recompute.
  • Funding is exchanged every hour between longs and shorts at the market's funding rate; it changes equity while a position is open.
  • Closing is an order in the opposite direction with reduceOnly. Full close at market: reduce-only IOC at a slippage-bounded price for the live position size.

Read positions and margin

ADDR=$HYPERLIQUID_ACCOUNT_ADDRESS
BASE=$([ "$HYPERLIQUID_NETWORK" = mainnet ] && echo https://api.hyperliquid.xyz || echo https://api.hyperliquid-testnet.xyz)
curl -sS -X POST $BASE/info -H 'Content-Type: application/json' -d "{\"type\":\"clearinghouseState\",\"user\":\"$ADDR\"}" | jq '{
  accountValue: .marginSummary.accountValue, totalMarginUsed: .marginSummary.totalMarginUsed,
  withdrawable, crossMaintenanceMarginUsed,
  positions: [.assetPositions[].position | {coin, szi, entryPx, positionValue, unrealizedPnl, liquidationPx, marginUsed,
    leverage: (.leverage.type + " " + (.leverage.value|tostring)), returnOnEquity, cumFunding: .cumFunding.sinceOpen}]}'

szi is signed size (positive long, negative short). leverage.type is cross or isolated; isolated positions also carry leverage.rawUsd (the isolated margin).

Margin tiers for a market:

curl -sS -X POST $BASE/info -H 'Content-Type: application/json' -d '{"type":"meta"}' \
 | jq --arg c ETH '(.universe[] | select(.name==$c)) as $u | ($u.marginTableId // $u.maxLeverage) as $id
      | {name:$u.name, szDecimals:$u.szDecimals, maxLeverage:$u.maxLeverage, marginTableId:$id,
         tiers: (if $id < 50 then [{lowerBound:"0.0", maxLeverage:$id}]
                 else ((.marginTables[] | select(.[0]==$id) | .[1].marginTiers) // [{lowerBound:"0.0", maxLeverage:$u.maxLeverage}]) end)}'

marginTables is a list of [id, {description, marginTiers: [{lowerBound, maxLeverage}, ...]}] for ids of 50 and above; the tier whose lowerBound (position notional in USD) is the largest one at or below your notional applies. Ids below 50 are single-tier tables whose max leverage equals the id and they are not listed in marginTables (most altcoins), which the snippet handles. Testnet tiers are far tighter than mainnet (BTC drops from 40x to 25x above only 10k notional on testnet), so a testnet rehearsal does not prove mainnet leverage.

Python equivalents: info.user_state(ADDR), info.meta(); the header from hyperliquid-orders applies.

Set leverage and margin mode (write)

Do this before the entry the ticket refers to. Leverage is checked when a position is opened (margin required = size x mark / leverage); the leverage of an existing position can be raised without closing it, which frees margin and moves the isolated liquidation price, and lowering it needs enough free margin to cover the higher initial margin. Either way, tell the user what changes.

# header from hyperliquid-orders (info, exchange, ACCOUNT)
res = exchange.update_leverage(3, "ETH", is_cross=True)     # 3x cross
# res = exchange.update_leverage(5, "ETH", is_cross=False)  # 5x isolated
print(res)                                                    # {"status":"ok","response":{"type":"default"}}
print(next((p["position"]["leverage"] for p in info.user_st
Полный SKILL.md на ClawHub

Установить HyperGrok Hyperliquid Positions в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл HyperGrok Hyperliquid Positions?

Manage Hyperliquid perp positions and margin from the desk computer - read positions and margin, set leverage and cross/isolated mode, add isolated margin, understand margin tiers and liquidation price, close a position with a reduce-only IOC, and clean up orphaned orders. Write actions are Execution Trader only, on an approved or mandate-covered ticket. Use for leverage changes, closes, protection checks and margin questions.

Как установить скилл HyperGrok Hyperliquid Positions?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл HyperGrok Hyperliquid Positions запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить HyperGrok Hyperliquid Positions с