Algorithm Balanced Funding Rate (ABFR)

The fundamental principle underlying ABFR is to safeguard the interests of SLP holders by dynamically adapting the funding rate according to the specific direction of a trading pair. When traders exhibit net profitability in a given trading pair, fees are gathered from them and provided as support to LPs. When traders face an overall loss, fees are acquired from LPs and allocated to traders. This mechanism guarantees that the combined unrealized and realized PNL of each trading pair tends to balance out to approximately zero over the long run. In this way, LPs wouldn't experience excessive returns but rather would generate income from fees (transaction fee + borrowing interest). The subsequent steps outline the overall process for calculating these dynamic funding fees.

Calculate the total profit and loss of LP at time t on the the trading pair

sign={1shortāˆ’1longĪ”t=openAmounttƗpricetāˆ’openSizetpnlt=realizedPnl+fundingFee+signƗĪ”t\begin{aligned}sign&=\begin{cases}1&short\\-1&long\end{cases}\\\Delta_t&=openAmount_t \times price_t - openSize_t\\pnl_t&=realizedPnl+fundingFee+sign\times\Delta_t\end{aligned}

  • Realized PNL signifies the actual profit and loss experienced by LPs due to changes in traders' positions, excluding the influence of fees.

  • FundingFee embodies the cumulative funding fees that have been gathered or distributed.

When PNL_t < 0:

ABFRt=min{K1Ɨlogāˆ£PNLtāˆ£,Rx}ABFR_t=\begin{aligned}min\left\{K_1\times log\left|PNL_t\right|,R_x\right\}\end{aligned}

When PNL_t > 0:

ABFRt=āˆ’min{K2Ɨlogāˆ£PNLtāˆ£,Ry}ABFR_t=\begin{aligned}-min\left\{K_2\times log\left|PNL_t\right|,R_y\right\}\end{aligned}

K1, K2 are constant coefficients

  • The reason for using the logarithm of pnl is to make ABFR change significantly when pnl is small and change slowly when pnl is large

  • ABFR has upper and lower bounds, with corresponding upper and lower rate limits Rx, Ry when pnl < 0 and pnl > 0, respectively

If a trader opens a position at time t1 and closes it at time t2, with a position size of size, the funding fee to be paid/received by the trader is

fundingFee=sizeƗāˆ«t1t2ABFRtĀ dtfundingFee=size\times\int_{t_1}^{t_2}ABFR_t\ dt

When the fee is positive, trader pays the funding fee to the LP

When the fee is negative, LP pays the funding fee to the trader

Last updated