How it works

Prints, accrual, settlement and early close.

A CARRY position is an exchange of two legs, settled print by print. The fixed leg is the rate you locked. The floating leg is each real funding print from the venue.

One period, step by step

  1. The venue's funding period ends (every hour on Hyperliquid, every 8 hours on Binance).
  2. The keeper reads that period's rate from the venue's public history and calls post_print(source_ts, rate).
  3. The program checks that source_ts is exactly the end of the next unprinted period and that the rate sits inside the per-period bound, then adds the rate to the market's cumulative index.
  4. Every open position in that market has now accrued notional x (print - fixed) for pay fixed, or the opposite for receive fixed.

Nothing is transferred per period. Accrual lives in the market's cumulative index, and money moves once, when the position exits.

sequenceDiagram
  participant V as Venue
  participant K as Keeper
  participant P as Program
  participant T as Trader
  T->>P: open_position(id, side, notional, margin, limit_rate)
  loop every finished period
    K->>V: read funding for the period
    rect rgba(209, 161, 72, 0.25)
    K->>P: post_print(source_ts, rate)
    end
    P->>P: cum_index += rate
  end
  T->>P: settle_position() after the last print
  P->>T: margin + accrued PnL in USDC

Units

QuantityUnit in the programExample
RateFraction of notional per period, scaled by 1e12HL BTC's baseline hourly print 0.0000125 is 12,500,000
Annual ratePer-period rate x periods per year / 1e1212,500,000 x 8,760 / 1e12 = 10.95%
AmountUSDC base units (6 decimals)$10 is 10,000,000

Periods per year are 8,760 for Hyperliquid and 1,095 for Binance.

Accrual

For a position opened at period entry_period with fixed rate fixed_rate:

accrued = sign x notional x ((cum_index - entry_cum) - fixed_rate x (next_period - entry_period))
sign    = +1 for pay fixed, -1 for receive fixed

Accrual runs in hp units (USDC base units x 1e12) and rounds once, at exit, against the trader.

Worked example

Over the 28 days to 24 November 2026, Hyperliquid BTC funding averaged 8.23% a year and paid $63.13 on $10,000 of notional.

Fixed rate lockedPay fixed resultReceive fixed result
5.00%+$24.77-$24.77
8.23% (the average)about $0about $0
10.95%-$20.87+$20.87

These figures exclude the upfront fee described in Economics.

Ways out

ExitWhenPrice
close_position(limit_rate)Any time the current period is runningAccrued PnL plus the remaining tenor marked at the exit quote
close_position after maturityAfter the last printAccrued PnL only
settle_position()Once every period is printed, or after maturity plus the settlement graceAccrued PnL; anyone may call it, the payout goes to the owner
liquidate()Margin plus value falls below maintenance at the anchorExit quote; a capped reward goes to the liquidator

When trading pauses itself

A trade is accepted only while the current period is still running (now < open_ts + (next_period + 1) x period_secs). Once a period ends its funding is public, and the market waits for that print before it quotes again (MarketStale). This keeps anyone from trading on a rate that is already known.