day 3 of 5

Sizing a delta-neutral position

Capital split, leverage, liquidation buffer, and the math behind hyperliquid_calc_delta_neutral_size.

<!-- SKYTO: review/edit before publishing -->

This is the day where most "I'll just run a basis trade" plans die — sizing wrong gets you liquidated on a 5% move that would otherwise be a non-event. Take it slow.

The trade you're sizing

You want to hold:

  • Spot leg: long ETH (or short ETH on margin, depending on direction)
  • Perp leg: short ETH-PERP (or long, opposite to spot)

Same notional on both. PnL from price moves cancels out. Funding income flows in. That's the whole game.

The constraint: liquidation distance

The perp leg uses leverage. Every dollar of leverage means less margin cushion against an adverse move. The exchange will close your position if the unrealised loss eats your margin.

For a 2x perp position, you have ~50% adverse move tolerance before liquidation, which sounds like a lot until you realise the hedge takes longer to settle than the close. Practical floor: keep 20-30% buffer between current margin and liquidation price.

The formula

capital            = C            (your total allocation)
leverage_perp      = L            (1.5x to 3x for production strategies)

spot_notional      = N            (what we want to solve for)
spot_capital       = N            (spot is unleveraged)
perp_notional      = N            (matches spot for delta-neutral)
perp_margin        = N / L
buffer             = C - spot_capital - perp_margin   (must be > 0)

solve N:
  C = N + N/L + buffer_target
  N = (C - buffer_target) / (1 + 1/L)

The Mentat helper

hyperliquid_calc_delta_neutral_size(
    capital_usd=10000,
    perp_leverage=2,
    buffer_pct=0.10,    # keep 10% in reserve for adverse-move calls
    asset="ETH",
)
# returns:
# {
#   "spot_capital": 6000.0,
#   "spot_notional": 6000.0,
#   "perp_margin": 3000.0,
#   "perp_notional": 6000.0,
#   "free_buffer": 1000.0,
#   "liquidation_distance_pct": 50,
# }

This tool is part of the Hyperliquid deputy. Your IronClaw agent will call it before sizing in.

A worked example, $10K, 2x perp leverage, 10% buffer

buffer_target = $10,000 × 0.10 = $1,000
N = ($10,000 - $1,000) / (1 + 0.5) = $9,000 / 1.5 = $6,000

→ long $6,000 of ETH spot
→ short $6,000 of ETH-PERP at 2x (uses $3,000 margin)
→ $1,000 sits idle in margin balance as a buffer

ETH funding at 0.01%/h annualises to ~87% on the perp leg.
On $6,000 perp notional, that's ~$5.20 per day in carry, before fees.

What can go wrong

  • Funding flips negative before you can close cleanly. Now you're paying.
  • Spot leg lags the perp leg during volatility — temporary delta exposure.
  • Liquidation cascade on the perp side eats your buffer faster than spot can absorb.

The agent we wire on day 4 watches these continuously. The kill switch we set up on day 5 closes the position when any of them trigger.

quiz · 3 questions

Q1. A delta-neutral funding-arb position is sized so that:

  1. Both legs have the same notional
  2. The hedge leg has half the notional of the funding leg
  3. Only the leg paying you funding has size
  4. Both legs are 10x leveraged

explain → Equal notional on long-spot + short-perp (or vice versa) is what 'delta-neutral' means — your PnL doesn't depend on price direction.

Q2. The biggest hidden cost of running 5x leverage on the perp leg is:

  1. Higher funding payments
  2. Reduced liquidation buffer — a small adverse move closes you
  3. Inability to withdraw collateral
  4. Exchange listing fees

explain → Leverage compresses your margin against the index price. The cheap funding income looks small after a forced close at the worst time.

Q3. If you have $10K of capital and want to deploy delta-neutral with 2x leverage on the perp leg, how much spot do you long?

  1. $10,000
  2. $8,000
  3. $6,667
  4. $20,000

explain → Spot uses ~$6,667 (one-third), perp short notional is also $6,667 (using $3,333 margin at 2x). Equal notional, full delta-neutrality, conservative leverage.

homework

Compute the sizing for a $5,000 capital allocation at 2x perp leverage. Show: spot notional, spot capital, perp notional, perp margin, free buffer.

Spot notional: $X | Spot capital: $X | Perp notional: $X | Perp margin: $X | Buffer: $X

Homework is acknowledged, never graded — do it for yourself.