Funding Payments

  • Updated

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

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 Rate

Funding payments are calculated based on the aggregate funding rate since the time your position was opened or last settled funding (whichever is shortest).

This funding rate is updated every Ethereum L1 block, based on the calculation

dailyFundingRate = (markPriceTwap - indexPriceTwap) / indexPriceTwap

15-minute TWAP is used in all cases.

On Optimism, block.timestamp is used in place of regular blocks, and each timestamp corresponds to an L1 (Ethereum mainnet) block. From the Optimism docs:

block.timestamp is pulled automatically from the latest L1 block seen by the L2 system

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

Untitled__3_.png

  • Click query
  • Divide the result by 10^18

Trigger Funding Settlement

Untitled__4_.png

  • Enter your web3 address (i.e., 0x...) in trader (address) under settleAllFunding

Untitled__5_.png

  • 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.

Screenshot_2022-06-15_at_21.06.41.png

Examples

The goal of funding is to move the mark price toward the index price.

  1. Mark price = $1000 | Index price = $1015 Short position holders pay funding Long position holders earn funding
  2. 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 * (fixed) 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 * (fixed) position size