Perpetual futures have no expiry, so exchanges use a funding payment to keep the perp price close to the spot price. Longs and shorts pay each other on a schedule. On Hyperliquid that schedule is every hour.
The formula is short, but two details catch people out: funding is paid on the full position, not on your margin, and hourly and eight-hourly rates are easy to mix up. Here is the math in TypeScript.
Disclosure: I am the founder of copy.top. We publish a free Hyperliquid funding rate calculator with live rates for every market. The code below is a minimal version written for this article.
The formula
funding paid = position value x hourly rate x hours held annualized rate = hourly rate x 24 x 365 When the rate is positive, longs pay shorts. When it is negative, shorts pay longs.
The code
type Side = "long" | "short"; interface FundingInput { side: Side; notional: number; // position value, e.g. in USD hourlyRatePct: number; // funding rate per hour, in percent; can be negative hours: number; } // Positive result: you pay. Negative result: you receive. export function fundingPaid(i: FundingInput): number { if (!(i.notional > 0)) throw new RangeError("notional must be positive"); if (!(i.hours >= 0)) throw new RangeError("hours must be zero or more"); const longPays = i.notional * (i.hourlyRatePct / 100) * i.hours; return i.side === "long" ? longPays : -longPays; } export const annualizedPct = (hourlyRatePct: number) => hourlyRatePct * 24 * 365; // Many exchanges quote funding per 8 hours. Convert before comparing. export const hourlyFromEightHourPct = (eightHourPct: number) => eightHourPct / 8; // Funding as a share of the margin you put up, not of the position. export const fundingOnMarginPct = (hourlyRatePct: number, leverage: number, hours: number) => hourlyRatePct * leverage * hours; The sign convention lives in one place: compute what a long pays, then flip it for a short. Returning a signed number keeps the caller honest: a negative value is money coming in.
Examples
fundingPaid({ side: "long", notional: 10_000, hourlyRatePct: 0.01, hours: 24 }); // ≈ 24: the long pays about 24 over a day fundingPaid({ side: "short", notional: 10_000, hourlyRatePct: 0.01, hours: 24 }); // ≈ -24: the short receives the same amount fundingPaid({ side: "long", notional: 5_000, hourlyRatePct: -0.005, hours: 72 }); // ≈ -18: with a negative rate the long is paid annualizedPct(0.01); // 87.6 hourlyFromEightHourPct(0.01); // 0.00125 fundingOnMarginPct(0.01, 10, 24); // ≈ 2.4 The last line is the one people miss. A rate of 0.01% per hour looks tiny. On a 10x position it is about 2.4% of your margin every day, because the payment is computed on the full position value.
Rates change every hour
The real rate is not constant. If you have the hourly history, sum it instead of multiplying:
export function fundingFromHistory(side: Side, notional: number, hourlyRatesPct: number[]): number { const longPays = hourlyRatesPct.reduce((sum, r) => sum + notional * (r / 100), 0); return side === "long" ? longPays : -longPays; } fundingFromHistory("long", 10_000, [0.01, 0.012, -0.004, 0.008]); // ≈ 2.6 This still keeps the position value fixed. In reality it moves with the price, so for a long holding period take the position value at each hour as well.
What the formula leaves out
- The exchange settles funding at fixed times on the position you hold then. Spreading it evenly over the hours held, as above, is an approximation.
- A high positive rate means longs are crowded and are paying to stay in. Some read it as a warning, others collect it from the short side. It is not a prediction of price.
- Funding is only one cost. Trading fees and slippage come on top, and a leveraged position can be liquidated long before funding matters.
If you only want the numbers, the hosted calculator shows the current hourly and annualized rate for each market. Nothing here is financial advice. Leveraged trading is risky, you can lose everything you put in.

