The funding rate is calculated based on the index price (the price of the spot or reference price) and mark price (market price) for the perpetual. When the rate is positive (perpetual trades at a premium relative to the index), long traders will make payments to short traders. While shorts make payments to longs when the rate is negative (perpetual trades at a discount relative to the index).