Funding rates are periodic payments either to traders that are long or short based on the difference between perpetual contract markets and spot prices. Therefore, depending on open positions, traders will either pay or receive funding.
At Spin the funding amount is calculated slightly differently than in most CEXs and DEXs.
The most common method for calculating the funding amount is to do it per some time interval. Let’s call this interval a financing period, the funding epoch. The most common funding epoch is either 1 hour or 8 hours. When it comes to on-chain perpetual trading, the smart contract has to call this method rather often to accrue the funding amount, especially if the number of users and markets available is big. This results in a spike in transaction fees.
Hence, at Spin, we came up with a more optimal method to calculate the funding amount: The funding event happens every time when the user changes or closes the position. The final funding amount Fa depends on several parameters: funding rate Fr, the position size S and time in the position Tp.
Funding rate Fr calculation:
Fr can't be more than +1% and less than -1%.
Funding amount Fa calculation: