Funding Payments
Content Out of Date
This content is not maintained and refers to an out-of-date version of Perpetual Protocol.
For the latest documentation, see https://docs.perp.com
Overview
Funding payments are the key mechanism used in perpetual futures to keep the mark price close to the index price. Traders will either pay funding, or earn funding. Simply put:
funding payments are paid by traders who move the mark price farther from the index price
funding payments are earned by traders who move the mark price closer to the index price
Makers (aka LPs) may also pay or earn funding, depending on their liquidity positions.
Key terms
Mark price - price of the derivative (perpetual future)
Index price - price of the real asset (spot price)
More tools
See more funding payment and history tools on our Dashboards.
Funding Payments
Funding payments are payed or received for all open positions, whether they are positions opened as market orders, or while acting as a maker (liquidity provider).
Funding is paid directly into or out of your free collateral. Free collateral is collateral deposited into the exchange, and separate from your wallet balance.
Earning or Paying Funding
If you see a positive payment, this means you paid this amount of funding.
If you see a negative payment, this means you earned this amount of funding.
Liquidation
If you are paying funding, your margin ratio is decreasing. It is possible that funding payments could lead to liquidation, if you do not actively monitor your positions.
Liquidations take unrealized (pre-settlement) funding payments in account—see the next section for funding settlement.
Funding for makers
Makers (aka LPs) may also pay or earn funding. If you have a long or short impermanent position, you will pay or earn funding on that position in the same way a trader would.
Example If you put in $1000 of liquidity on either side of the current price, and the price of that asset decreases, you will have a long position. If the funding rate is negative, you will earn funding on the long position. If the asset price goes above the starting price, you will now have a short, and pay funding on that position (assuming funding is still negative).
Funding Rate
Funding payments are calculated for each position based on the aggregate funding rate since the time your position was opened or funding was last settled (whichever is shortest).
This funding rate is updated every block.timestamp
(15 seconds), based on the calculation:
7-minute TWAP is used in all cases.
On Optimism, block.timestamp
is used in place of regular block timestamps. From the Optimism docs:
The
TIMESTAMP
opcode (block.timestamp
in Solidity) uses the timestamp of the transaction itself. It gets updated every fifteen seconds.
Funding Period & Settlement
Funding Period
Funding is not calculated at regular intervals as on other perpetual contract exchanges (e.g. 1 hour), but continuously over the time your position is open.
Funding Settlement
Settlement occurs in the following conditions:
1 single market settles funding during
add/remove Liquidity
open/close Position
liquidation
All markets settle funding when you withdraw collateral (not deposit)
Manually View or Trigger Funding
Pending funding payments can be viewed by going to History.
You can also use Etherscan to manually perform some useful funding related operations.
View Pending Funding
Visit this Etherscan contract
Enter your web address (i.e., 0x...) in trader (address) under getAllPendingFundingPayment
Click query
Divide the result by 10^18
Trigger Funding Settlement
Visit this Etherscan contract
Connect your web3 wallet (e.g., MetaMask)
Enter your web3 address (i.e., 0x...) in trader (address) under settleAllFunding
Click Write and approve the transaction in MetaMask.
Funding Payment History
You can view funding payments for closed positions in History > Funding Payments. Pending funding payments are also shown under a separate tab.
If you see a positive payment, this means you paid this amount.
If you see a negative payment, this means you earned this amount.
Examples
The goal of funding is to move the mark price toward the index price.
Mark price = $1000 | Index price = $1015 Short position holders pay funding Long position holders earn funding
Mark price = $1015 | Index price = $1000 Short position holders earn funding Long position holders pay funding
Funding Payment Calculation
Per-block funding calculation is based on cumulative time-weighted premium.
Global funding variables are updated at the first transaction of each block and recorded in time-weighted fashion.
Personal funding payments are settled whenever users have pending funding payments yet to be settled.
The cumulative time-weighted premium is calculated using the 15-minute TWAP of mark and index prices. This value is updated each Ethereum L1 block.
Calculation
Funding for takers:
We need only the cumulative time-weighted premium, which is the cumulative value of cumulative time-weighted premium * position size
cumulative time-weighted premium = summation of each premium * how long it lasts
Funding for makers:
When the current price is a maker's range:
We use the cumulative time-weighted premium & cumulative time-weighted premium * 1 / sqrtPrice(current price)
When the current price is not in a maker's range (the price is lower than the lower bound of makers' ranges):
As makers' base token amount/position size are consistent in this scenario, we only need cumulative time-weighted premium for calculation: cumulative time-weighted premium * position size Note: Position size will vary with asset price, assuming your liquidity is in range. If your liquidity is out of range, you will either have a fixed position size or zero position size.
Manual Funding Rate Calculation
Rate calculation
To calculate the funding rate yourself, you'll need TWAP of mark and index prices.
TWAP of mark and index prices can be obtained from events from a peripheral contract
or by calculating them locally from mark and index price:
Payment calculation
Funding payments are a sum calculated using funding rates during the period when your position was open, to the nearest second. Full math can be found here.
Last updated