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
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:
When PNL_t > 0:
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
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