How Is a TWAP Used in Calculating the ‘Funding Rate’ of a Perpetual Swap?
The funding rate in a perpetual swap is a periodic payment between the long and short sides, designed to keep the contract's price (mark price) anchored to the underlying asset's spot price (index price). A Time-Weighted Average Price (TWAP) of the index price is often used to calculate the funding rate to prevent temporary price spikes from causing wild swings in the payment.
This ensures the rate is based on a stable, fair representation of the underlying market.