Search
K

Funding Calculation

Funding Fee:

F=1RT8 hoursBXF=-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(IRPremium,D,D)r = Premium + clamp(IR-Premium, -D, D)
R=clamp(r,0.75Mi,0.75Mi)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
    maxaminmax\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 PriceIndex Price)Max(0,Index PriceImpact 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
Level
Price
Quantity
Notional Quantity
Accumulated Notional Quantity
1
p1p_{1}
q1q_{1}
p1q1p_{1}*q_{1}
p1q1p_{1}*q_{1}
2
p2p_{2}
q2q_{2}
p2q2p_{2}*q_{2}
p1q1+p2q2p_{1}*q_{1}+p_{2}*q_{2}
3
p3p_{3}
q3q_{3}
p3q3p_{3}*q_{3}
p1q1+p2q2+p3q3p_{1}*q_{1}+p_{2}*q_{2}+p_{3}*q_{3}
...
...
...
...
...
n
pnp_{n}
qnq_{n}
pnqnp_{n}*q_{n}
pnqn\sum p_{n}*q_{n}
Find the first X level such that
i=1Xpiqi<INV<i=1X+1piqi\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:
INVi=1Xqi+INVi=1XpiqiPx+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.