Funding
Overview
Funding is a regular payment between longs and shorts that keeps a perp’s price close to its oracle price. It is peer-to-peer: one side pays the other, and Loaf collects no fee on the payments.
Funding allows a perp to track an asset that may have no other market, and compensates the traders who bring a drifting price back toward it. Every premium Loaf measures is published in its public intake journal, so the rate can be verified.
The funding rate has two parts:
- Premium. How far the perp’s order book sits above or below the oracle price. When the book sits above, the premium is positive and longs pay shorts. When it sits below, the premium is negative and shorts pay longs.
- Interest. A carry term set for each market TBC. While the premium is small, the rate settles at this term.
Each market has a funding period, set on the blockchain TBC. Funding is paid once every period, and each payment is added to or taken from the margin behind your position. When the rate is high, it pays traders to take the other side, which pulls the perp back toward its oracle price. Spot holdings never pay funding.
How the premium is measured
Loaf measures each perp’s premium from its order book:
premium = (max(impact bid - oracle price, 0) - max(oracle price - impact ask, 0)) ÷ oracle priceThe impact bid and impact ask are the average prices you would get selling, and pay buying, the market’s impact notional against the book: by default, US$100 times the market’s maximum leverage, such as US$1,000 at 10x. Measuring at a meaningful size, not at the best bid and ask, means a small order at the top of the book cannot move funding. A side of the book too thin to fill the impact notional counts as the oracle price.
The premium is positive only when even the impact bid is above the oracle price, and negative only when even the impact ask is below it. While the oracle price sits between the two, the premium is zero.
A market that is halted, or whose oracle price is stale or held, takes no sample.
How the rate and payments are set
Each period, the rate is worked out from the average of that period’s premium samples. It is quoted over 8 periods and paid an eighth at a time:
funding rate (8 periods) = average premium + clamp(interest term - average premium, -0.05%, 0.05%)
payment rate = funding rate ÷ 8, within the market's cap
funding payment = position size × oracle price × payment rateWhile the average premium is within 0.05% of the interest term, the rate equals the interest term. Beyond that, the rate follows the premium, 0.05% closer to the interest term.
Each market’s payments are capped TBC. Whatever a market’s settings, the blockchain never allows more than 4% an hour. Each payment is valued at the oracle price, not the mark price.
Funding changes the margin behind a position, so it can move your liquidation price over time.
Timing, halts and stale prices
- Each funding tick pays exactly one period, even if it runs late.
- If a market’s oracle price is stale when the tick runs, the tick pays nothing and the period starts again.
- While a market is halted, funding waits. The first tick after the halt pays one period.
Example
This example is illustrative and does not show any market’s actual settings.
- A perp has a funding period of one hour and an interest term of 0.
- For the whole hour, its impact bid sits 0.10% above an oracle price of 10.00 USD, so every sample’s premium is 0.10%.
- Clamp: 0 - 0.10% = -0.10%, which is clamped to -0.05%.
- Funding rate over 8 periods: 0.10% - 0.05% = 0.05%.
- Payment rate for the hour: 0.05% ÷ 8 = 0.00625%.
- Payment on a long of 1,000 units: 1,000 × 10.00 USD × 0.00625% = US$0.625.
As a long, you pay US$0.625 to shorts for that hour, and a short of the same size receives it.
Where to see it
On a perp, the header shows the current payment rate for one funding period, with a countdown to the next payment (see The trading interface). Each premium Loaf measures is also published in its public intake journal.
Warning. Funding can cost you money over time even when the price has not moved against you.