The Funding Rate comprised of two main parts: the Interest Rate and the Premium/Discount factors. Funding is derived by multiplying contract value with funding rate.
Funding aims to keep the traded price of the perpetual contract in line with the underlying reference price. In this way, the contract mimics how margin-trading markets work as buyers and sellers of the contract exchange interest payments periodically.
Funding occurs every 8 hours at 16:00 UTC, 00:00 UTC and 08:00 UTC. You will only pay or receive funding if you hold a position at one of these times. If you close your position prior to the funding exchange then you will not pay or receive funding.
For more information, please click here or refer to this video.