# How much are you charged when opening/closing a position and borrowing assets?

5 min readJul 3, 2021

In this article, I will take Rabbit Finance and Alpaca Finance for reference, calculate and analyze fees charged and slippage occurred when farmers open and close positions with stablecoin (BUSD, USDT as example) leveraged farm, and cost of borrowing assets.

In the case below I will use 200 USDT as principal and borrow 1000 USDT. Thus, the total position value is 1200 USDT, to do 6x leverage farm USDT/BUSD LP on Ellipsis and PancakeSwap.

Rabbit Finance open position 0xc1f04d5c623bc9ac981f59723eb054e253dfe555eb92885df168711c41de4df8

Rabbit Finance close position

0xa84ffd6a3ac76dee3f6ef958a73d2f6f6441386ac55a416d2b2f97ec2aa3c08c

Alpaca Finance open position 0xf16eed6275bc25aaa4303c4777d2ac0b262859fb8b5252c82df08f6a323e4622

Alpaca Finance close position 0xe1886344c3decff5d9773f5d74e51921b6850b3bdbc73caf062ec9510bfa7f53

Rabbit Finance Open / Close Position Data Record

Open Position Data

Records of asset transaction

Step 1

You can see the 200 USDT invested in, and the 1000 USDT borrowed from the vault of Rabbit Finance. To synthesize LP we need to exchange some of the USDT borrowed into BUSD, we will do that on Ellipsis for a super low exchange fee and slippage (which is one feature of Rabbit Finance).

Step 2

The record here shows us how the exchange on Ellipsis is done, we can see 600.1188 USDT is exchanged to 599.9543 BUSD.

Step 3

The assets (598.7970 BUSD+599.8811 USDT) are synthesized into LP.

Let’s check the hash below.

Ellipsis would return the 1.157 BUSD to the wallet, so it should be minus from farming position value

The currency at the time is 1.1572 BUSD=1.156589 USDT, so the farming position value is 1200USDT-1.156589USDT=1198.843411USD. The position value synthesized into LP is (598.797BUSD+599.8811USDT).

The process of an open position is finished here.

Close Position Data

Next, let’s analyze how close the position works on Rabbit Finance.

RabbitFinance close position hash

Step 1

After LP is removed, we obtain 599.2866 USDT and 599.412 BUSD

Step 2

Exchange 599.412 BUSD to 599.09 USDT on Ellipsis.

Step 3

The position value when close the position is

599.412BUSD（599.0965USDT）+599.2866USDT=1198.3831USDT

Alpaca Rabbit Finance Open / Close Position Data Record

Open Position Data

With the same method, let’s check the cost of open position on Alpaca Finance

Step 1

Position value at the opening is 1199.924 USDT

Step 2

600.7121 USDT exchanged into 598.125 BUSD on PancakeSwap

Step 3

The position value synthesized into LP is 598.125BUSD+599.21265 USDT

Open position finished

Step 1 Remove LP

Step 2 Exchange BUSD to USDT

Step 3 999.9 return to Vault, 196.3 BUSD to the user

Position value after close position is 999.9689USDT+196.3BUSD（196.196USDT）=1196.16USDT

Data Comparison

The trading fee and slippage are significantly different on Ellipsis and PancakeSwap , which results in a completely different experience for users when farming on stablecoin leveraged farms. The trading fee on PancakeSwap is 0.25%, meanwhile, the trading fee on Ellipsis is 0.04% (There will be minimal slippage when large assets are exchanged). Therefore, Rabbit Finance has obvious advantages in the cost of opening and closing positions compared to Alpaca Finance.

Actual data of 6x leverage farm open/ close position is shown as follow,

RabbitFinance

RabbitFinance position value at opening: 1198.84USDT

RabbitFinance position value at closing: 1198.3831USDT

Loss: 0.46USDT

Loss rate: 0.46/1198.84 = 0.038%

AlpacaFinance

AlpacaFinance position value at openning：1199.92 USDT

AlpacaFinance position value at closing: 1196.16 USDT

Loss: 3.76USDT

Loss rate: 3.76/1199.92=0.3%

Conclusion

In the case above, with the same amount of token supplied and borrowed, the position holding time is similar. Compared to Alpaca, Rabbit Finance saved up to 87.3% cost for the users caused by trading fees and slippage.

Cost of Borrowing

When you do leveraged yield farming, there will be borrowing interest, with the same amount of token supplied and borrowed, position holding time is similar, let’s compare the real cost when holding the position in the case above.

Both of the 2 platforms use a triple-slope interest rate model to determine the borrowing interest, then determine the Utilization with the borrowing interest, or vice versa.

The triple-slope interest rate model is as follow,

Rabbit Finance Interest Rate Model

Alpaca Finance Interest Rate Model

Combined the transaction record of the vault, we get the information below,

Rabbit Finance

USDT Vault Contract:0xc18907269640d11e2a91d7204f33c5115ce3419e

Token Borrowed 1000 USDT

Token Returned 1,000.012707626927500359 USDT

Interest while holding the position: 0.01270762 USDT

Alpaca Finance

USDT Vault Contract: 0x158da805682bdc8ee32d52833ad41e74bb951e59

Token Borrowed 999.92479126062835902 USDT

Token Returned 999.968918488703230413 USDT

Interest while holding the position: 0.04412714 USDT

Conclusion

In the case above, with the same amount of token supplied and borrowed, the position holding time is similar. Compared to Alpaca, Rabbit Finance saved up to 71.2 % of the cost for the users from borrowing interest.

--

--