# Funding

**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.&#x20;

At Spin the funding amount is calculated slightly differently than in most CEXs and DEXs.&#x20;

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.&#x20;

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&#x20;*****Fr*****&#x20;calculation:**

![](https://lh5.googleusercontent.com/wxXWzNHS1CEI0SEGZniW4yMNtctWpOmrjHjmwjE7sukXCrd6RKBxvOvSxSndkttlcaoxkZ_5Vpfl6Gv1GoaiZcPFCifQOnMwSwf4sYDX_jmHOD8Ak_gdEW6bw724KdBGJYJJTY2vf9m3iWZqsY0kpRI)

Fr can't be more than +1% and less than -1%.

**Funding amount&#x20;*****Fa*****&#x20;calculation:**

![](https://lh6.googleusercontent.com/Z3tGD0qCM1DvizXIylLb4iQZHnc0DRfvESHt7ZZzEZN9XH5zv2bA7E3KTE23Eww7GlHu7v1Bl2LbCgcC4FS2TMcGMrvSCgL1qrkO8-EDW4H2Go6G76eYs8VWL9yA80mpWEPG3u4AIGydMSTknDVpry4)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spin.fi/tech-documentation/futures/funding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
