DeFi notes to girlfriend: impermanent loss
Kay
2020-10-12 03:20
本文约3178字,阅读全文需要约13分钟
Provide some common sense about DeFi in the most easy-to-understand language, including not limited to conventional concepts such as impermanent loss/AMM, or analysis of new project principles and designs.

You'll meet someone who won't let you have the heart to waste the rest of your life. Do you know? You know your mother, you won't, stop dreaming. You will only meet a love who cares about every detail, ordinary jobs with ordinary salaries, cheating in marriage after 40, taking pleasure in grabbing red envelopes during festivals, halfway through sex, you fall asleep, and Happy Camp is still playing on TV, don’t care about it for six years The child's homework suddenly went to school every day to pick him up, the middle-aged Zhang Dachui who just wanted to sleep with his child's beautiful head teacher in the new semester. And all this is because you didn't know how to push impermanence losses at the beginning, and you only blamed yourself for entering the market too late when you were finished by MEME Coin 🈹.

Or, after waking up from a nightmare many years later, it turns out that all the gaps are cognition.

DeFi is cool in autumn, when you are proud, do more things, you need to look at Dali like crazy, and when you are frustrated, read more, Dali is like a mountain.

Author: Kay, a male student without a story.

Author: Kay, a male student without a story.

definition

Disclaimer

  • I don't have a girlfriend right now

  • I love women

  • The author is extremely opposed to gender discrimination that has no scientific basis, such as "boys are born to study science, and girls are better off with natural arts"

definition

Han Han translation

Impermanent loss, generally translated as impermanent loss in Chinese, is a translation as bad as "robustness", and there is no way to "make sense of the text".

Robustness is literally translated into "robustness", isn't it good, translated into robustness, emmm, the other party doesn't want to talk to you and throws you a Khrushchev

Impermanent loss is not good if it is literally translated as "non-permanent loss". In the Chinese context, "impermanence" seems to have nothing to do with it except Buddhist terms.

I thought it was as scary as black and white impermanence.

Oh, the loss of impermanence can bring your money back to zero, and it can really be as terrible as black and white impermanence.

two prerequisites

Before understanding impermanence loss, there are two other things to understand first:

1. Friends who have done (kui) market (qian) in Uniswap know that when adding liquidity, the two tokens are basically equivalent at the current market price. If the instantaneous market price is 1ETH=400USDT, adding liquidity can only be done by This ratio to add:

  • 1ETH with 400USDT

  • 1.5ETH with 600 USDT

  • 2ETH with 800USDT

  • ……

2. We will not talk about Uniswap here. Even for traditional CEX, market making is similar to grid trading. When the currency falls, you increase your position and when it rises, you reduce your position. In jargon, it is called earning spread. If the price fluctuates greatly, it is very likely to lose money. In short, market making is a transaction, and there is a possibility of loss, not a risk-free arbitrage.

Combining the above two points, smart girlfriends (you can already come to a conclusion by mistake, go to Uniswap to make a market, in essence, give two kinds of coins with a market price of 1:1 to a black box like Uniswap (actually a white box, I will talk about it later) A trading robot comes to run a trading strategy.

earn less is lose

At this time, there is a comparison. What if the money is not used to market? So many bigwigs in the currency circle are shouting to hoard BTC / ETH, the coach, I also want to hoard coins, and I want simple and beautiful little happiness.

Yes, the definition of impermanent loss is like this, that is, the ratio of making money less than directly hoarding coins when you use it to make a market (less profit is a loss). In jargon, it is called opportunity cost-if you use it to make a market , you will lose the possibility of hoarding coins to make money safely and steadily.

For the definition of impermanent loss, let’s take a look first:

Since AMM market making is a transaction, and hoarding coins is also a transaction, can we distinguish the good from the bad in advance?

Really can.

Let me give the conclusion directly, this is the impermanent loss curve of the 50:50 pool, the horizontal axis is the price change, and the vertical axis is the impermanent loss:

It can be seen that the impermanence loss on the graph is always negative.

The impermanence loss is always negative.

has been negative.

……

In other words, as long as you start making a market, you will earn less than just hoarding coins without making a market.

Ah no, it’s not just about making less money, if the currency price falls, you will lose more in market making than in hoarding currency.

secondary title

who will do business at a loss

Seeing this, do you have tens of thousands of grass and mud horses galloping in your heart? Why would anyone do such a loss-making business? ? ?

Oh, although it is definitely less profitable than hoarding coins here, but life is full of trade-offs, just like programmers like to trade space for time, although it is definitely less profitable than hoarding coins in terms of currency price fluctuations, in fact There is a little other income, you can get a 0.3% transaction fee for each transaction in Uniswap market making.

In other words, within a certain period of time, if the transaction fee > impermanent loss, it is possible to make more money than simply hoarding coins.

So, is everyone making money?

As of May this year, LINK has doubled seven-fold in the past year, but what if it was used to make a market on Uniswap a year ago?

Under the magnificent market, the ETH standard actually lost -52.67%

……

is it still possible to make money

I am also very disappointed, but there are still some.

Looking back at the impermanence loss chart, it can be observed that the impermanence loss of the curve is relatively flat in the neighborhood of 1. In other words, just like the market making of centralized exchanges, it is possible to make money if the price fluctuates little.So there are three general ideas:

  • Choose a currency with high price correlation, the price fluctuation of trading pairs is generally relatively small, such as USDT/USDC, or WBTC/ETH

  • Looking forward to a significant increase in the overall trading volume of Uniswap in the long term,make time friends(If you don't look at it, there is no impermanence doge)

  • In the liquidity mining method before the resumption, compared with directly opening Pool2,The risk is actually similar to that of directly stud buying coins, and even after Risk-Adjusted, the income after buying coins will generally be higher

hand push impermanence loss

Every additional formula in a popular science book will reduce sales by 50%.

— Hawking

So this paragraph is placed in the last part of the article, first give the conclusion and then push it by hand. Friends who don’t want to watch can go directly to the article and like it~

push & explain

  1. NS is non-stablecoin, the number of non-stable coins, such as ETH, and S is the number of stable coins, such as DAI or USDT

  2. NS*S is a fixed constant, which is the mechanism of AMM. Even friends who don’t understand the mechanism of AMM at all should have heard about the fixed product (AMM will have a chance to write another article later)

  3. Price = S/NS, this is too obvious, S/NS can be replaced by USDT/ETH, if you add a price, 400 USDT/ETH, is it exactly the same as what you see in the CEX world?

  4. ② Only the positions of both sides of the equation are changed

  5. ①/②, the number of S is eliminated, and the number of non-stable coins can be obtained only by using Price and k

  6. Similarly, combining ① and ③ can get the number of non-stable coins obtained only by Price and k

  7. secondary title

sample

Ok, now that we have the formula, let's put in the data and actually calculate:

Suppose the user injects 100 ETH and 10,000 DAI into the Uniswap liquidity pool, in other words, NS = 100, S = 10,000, at this time Price = S / NS = 100 DAI / ETH, fixed product k = S * NS = 100 * 10000 = 1000000

Now suppose that the external market pulls the market, and ETH rises to 120DAI. Due to the price difference, the arbitrageur starts to work at this time. The arbitrageur keeps the price in the liquidity pool consistent with the external market by moving bricks. At this time, the latest The number of

So, the market making balance is:

If there was no market making at the beginning, the balance of directly hoarding coins would be:

To review, the definition of impermanent loss is:

Substitute:

It can be seen that after the price changed from 100 to 120, compared with no market making, it lost about 0.4%, that is, impermanent loss. If the currency price in the liquidity pool returns to 100, we have no loss. This is why it is called impermanent loss The reason for the impermanent loss.

To sum up, it can be found that under the overall context, only the price change needs to be known, and the change behavior of market-making shares is fixed. This is why Uniswap is said to be a "white box" rather than a "black box" above.

another formula

In fact, for the 50:50 pool, there is a more convenient formula, which only needs to use the price change ratio, but the derivation process is relatively complicated (it is enough to use the above pre-conclusions), and those who are interested can derive it by themselves. The priceRatio here is 90% for example. % is 0.1, unchanged is 1, doubled is 2, and so on:

calculator

It's over! I'm so tired, I'll use it next timeCalculator for CMCBar 233 It should be noted that the calculator Price change, for example, falls by 90%, you need to input -90% (manual doge

refer to:

refer to:

[1] https://medium.com/

[2] https://medium.com/

[3] https://cryptocam.tech/

Kay
作者文库