Funding Calculation

Funding Fee:

F=āˆ’1āˆ—Rāˆ—T8Ā hoursāˆ—Bāˆ—XF=-1*R*\frac{T}{8 \ hours} * B*X
  • F: Amount received/paid

  • R: 8-hour rate

  • B: Net position (+, -)

  • X: On-chain price;

  • T: Interval time between funding fees (8 hours)

The funding rate is updated every minute and paid on an 8-hour basis.

Funding Rate (R) Calculation:

r=Premium+clamp(IRāˆ’Premium,āˆ’D,D)r = Premium + clamp(IR-Premium, -D, D)
R=clamp(r,āˆ’0.75āˆ—Mi,0.75āˆ—Mi)R=clamp(r, -0.75*M_{i}, 0.75*M_{i})

where:

  • ClampClamp: Clamp(x, min, max) represents when X<min, then X=min; if x>max, then X=max; If maxā‰„aā‰„minmax\ge a \ge min,then return X.

  • DD: A dampening factor, D=0.05%

  • IRIR: Interest Rate = 0.01%

  • MiM_{i}: maintenance margin rate

  • PremiumPremium: Premium Rate

Premium Rate Calculation:

We need to calculate the premium first to get the funding rate R. The premium rate is calculated every minute based on the current distribution of price in the order book:

Premium(mins)=(Max(0,Ā ImpactĀ BidĀ Priceā€“IndexĀ Price)āˆ’Max(0,IndexĀ Priceāˆ’ImpactĀ AskĀ Price))IndexĀ PricePremium(mins)=\frac{(Max(0, \ Impact\ Bid\ Price ā€“ Index \ Price) - Max(0, Index\ Price - Impact\ Ask\ Price)) }{Index\ Price}

At the end of every 8-hour period, we first calculate the premium of each minute(Premium(mins)), and then take the arithmetic mean of the sum of Premium(mins) to get the 8-hour premium(Premium(hours)).

Premium(hours)=mean(āˆ‘premium(mins))Premium(hours) = mean(\sum premium(mins))

where:

  • Index Price: Off-chain price, the average of the index prices of major exchanges

  • Impact Bid Price: Calculated based on Impact notional value (INV) of the bid-side order book

  • Impact Ask Price: Calculated based on the Impact notional value (INV) and the ask-side order book

  • Impact Notional Value(INV): A system default effective impact amount. Different trading pairs may have different INV. Current INV is 3000MaintenceĀ MarginĀ Rate\frac{3000}{Maintence \ Margin\ Rate}

Impact Ask Price calculation:

Ask-side order book

LevelPriceQuantityNotional QuantityAccumulated Notional Quantity

1

2

3

...

...

...

...

...

n

Find the first X level such that āˆ‘i=1Xpiāˆ—qi<INV<āˆ‘i=1X+1piāˆ—qi\sum_{i=1}^{X} p_{i}*q_{i}<INV<\sum_{i=1}^{X+1} p_{i}*q_{i}, e.g. If the first level satisfied the condition, then the Impact Ask Price = P1P_{1}.

Impact Ask Price:

INVāˆ‘i=1Xqi+INVāˆ’āˆ‘i=1Xpiāˆ—qiPx+1\frac{INV}{\sum_{i=1}^{X}q_{i}+\frac{INV-\sum_{i=1}^{X} p_{i}*q_{i}}{P_{x+1}} }

Impact Bid Price Calculation:

Similar to the impact ask price calculation.

Last updated