header-langage
简体中文
English
Tiếng Việt
Scan to Download the APP
Partnered With:

Popular Science: An easy way to calculate the changes in your own LP liquidity pool funds

Read this article in 5 Minutes
Changes in the amount of your LP funds, most of the time there is no need to calculate the so-called "impermanent loss".
Original title: "Easy way to calculate the change of your own LP liquidity pool funds"
Original Source: Crypto Utopia



DeFiLiquidity mining has been It has lasted for so long, but many people still don't know how to calculate how the amount of funds injected into the liquidity pool LP will change.


First determine two principles:


First, most of the changes in your LP funds do not need to calculate the so-called "impermanent loss", so don't worry about it.


The change in a currency's price relative to another currency's price.


Accounting formula


General LP pools use Uniswap are consistent, and it is 1:1 equivalent encrypted asset injection.


The quantity of these two encrypted assets is defined as: a and b


The latest price of encrypted asset a is defined as: Pa


< /p>

K=a*b


When joining the liquidity pool, K is determined, K is a constant and does not change.


Using b as the benchmark, whoever is more valuable or whose volatility is smaller is the benchmark. We uniformly define this as b.


Calculation method:


a*b=K Get K first, this value is a constant and does not change


Quantity b=under root (K*Pa)


< span>Now the total value of your LP is equal to: twice of b


The simple formula is summarized as: funds Quantity = 2*under root (K*Pa)


Remarks: For the convenience of expression, the following USDT and US dollars are common, 1USDT=1 US dollar.

as the benchmark.


a=root (K/Pa)


use ETH< /span>-USDT as an example:


The state when injecting LP< /span>


ETH-USDT LP Liquidity Mining


< p>The benchmark above is b, and the benchmark b here is USDT.


When liquidity is injected, the price of 1ETH is 1000USDT.


10 ETH is 10000 USDT, a=10


10000USDT, b=10000


So:

< br>

When the LP is injected, your personal capital amount is20,000 US dollars


K=a*b=100000


now Status:


The price of ETH has risen to $2,000, how much money is left in the pool?


Formula: b=under root (K*Pa)=under root (100000* 2000)=14142


Fund change: 14142*2=28284USDT


So, your LP pool has changed from $20,000 to $28,284.


Has impermanence loss occurred? produced. Has the amount of money increased? grew. The two are not contradictory.


If I didn’t participate in LP mining at the beginning, but just held ETH and USDT, how much is it worth now?


10 ETH has doubled, so it is worth 20,000 US dollars;


The 10,000 USDT in hand has not been moved, so the combination of the two is 30,000 US dollars.


The difference between $30,000 and $28,248 is impermanent loss.


However, when participating in liquidity mining, it is often not necessary to calculate the impermanent loss. Funds are not growing now. Taking b as the benchmark, as long as the price of a increases relative to b, my funds (based on b) will increase.

How much will my LP principal lose?


Similarly, the amount of funds now=2*under the root sign (K*Pa)=2*under the root sign (100000*600)=15492USDT


Originally It was $20,000, and now it is $15,492.


If you don’t add LP if you don’t hold it, how much should it be?


A total of 16,000 US dollars.


The difference between 15492 and 16000 is impermanence loss.


Use BTC-ETH for example:


ETH is the benchmark, that is, when b


is put in, 1BTC=27ETH.


You put in 1BTC and 27ETH, the value is 1:1.


K=1*27=27


< p>Now the price of ETH has increased (the price of BTC has increased), and now 1BTC=10ETH.


That is Pa=10


How do you calculate how much is now worth in the pool? How to calculate how much BTC and how much ETH are left in the pool?


b=root (27*10)=16.43


This is the number of b. That is to say, there are 16.43 ETH in the pool now, and now 1BTC=10ETH, so the number of bitcoins should be 16.43÷10=1.643units


Currently lying in the pool: 1.643BTC and 16.43ETH


When I joined: 1BTC and 27 ETH


The current total value is of course equal to: 16.43*2=32.86ETH


When joining, the total value is equal to: 27* 2=54ETH


Using ETH as the benchmark price, now your amount of funds isfrom 54ETH becomes 32.86ETH.


Going further:


< /p>

Using BTC as the benchmark, the current amount of funds isfrom 2BTC to 1.643BTC*2=3.286 BTC


So, the amount of funds denominated in Bitcoin has increased, and the amount of funds denominated in ETH has decreased, so my amount of funds has increased Or less? Find the actual price of ETH or BTC at that time, and you will know it by multiplying it.


This is the small currency-ETH pool. When the small currency drops sharply against ETH, ETH It will decrease rapidly, and the reason for leaving a bunch of this small currency in hand is because the quantity b is the quantity of ETH, which rises with the rise of Pa and falls with the fall of Pa.


When calculating, a benchmark should be selected. Generally, the LP pool is composed of small currencies plus a stable currency (DAI or USDC or USDT, etc.) or ETH or BTC, then these latter more stable currencies (USDT, DAI, USDC, BTC, ETH, etc.) as the benchmark is calculated by b. The increase or decrease in the amount of funds is also calculated based on these more stable targets.


The above calculations, if you readers study carefully and repeatedly deduce, you will suddenly become enlightened.


Remarks: For the convenience of reading, the formulas in this article are expressed with "under the root sign". If you add a formula in the Excel table, you can use "Sqrt" to calculate the root sign.


Original link




Welcome to join the official BlockBeats community:

Telegram Subscription Group: https://t.me/theblockbeats

Telegram Discussion Group: https://t.me/BlockBeats_App

Official Twitter Account: https://twitter.com/BlockBeatsAsia

举报 Correction/Report
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit