The funding rate on Mushino is calculated as the relative difference between the Index Price and the Mark Price.

This difference is also known as the premium/discount. If the Mark Price is above the Index Price, futures on Mushino are trading at a premium. If the opposite is true, futures are trading at a discount.

The purpose of Funding is to eliminate this premium/discount.

The premium is calculated as follows:

((Mark Price - Index Price) / Index Price) * Interest

where Interest is the 8 hour interest rate on the Future's underlying asset.

Once the premium is obtained, the Funding Rate can be calculated by taking the premium and applying a dampener:

Max(dampener, Premium) + Min(dampener, Premium)

The dampener can vary by trading pair. For BTC, it is currently set to 0.01 (1%).

The dampener ensures that the Funding Rate can only ever be within an interval of

[-dampener,+dampener]

To calculate the funding on your position, we must first scale the funding rate to reflect only the interval for which funding takes place:

Scaled Funding Rate = (Funding Interval/Funding Time Window)

where the Funding Time Window is 8 hours and the Funding Interval is 0.5 hours.

Then simply multiply the Scaled Funding Rate with the size of your position to get your funding:

Funding = Scaled Funding Rate * Position Size (BTC)