Understanding AMM mechanics
If you like math and quantitative finance, you will love Uniswap V3, but unfortunately most people don’t, which is why I don’t have many friends…
So before we start looking at Uniswap V3 strategies, let’s make sure we understand the concepts and mechanics of liquidity provision.
I tried and tested this gamified method on my wife with a Duplo lego set; for people who don’t have Duplo, you can do the same with a board of Go, Othello, Reversi, Chess or just a piece of paper and some beans.
The Game Board
I started by building a simple 11x8 game board, 5 white tokens and 6 black tokens, and laid it as per below:
Rules of the game:
You own 5 white tokens and black tokens.
You want to create a automated market place for people to buy and sell white and black tokens without bothering you.
You lay out your tokens as per above to create a buying and selling range.
The Y-axis it the amount of tokens you have for sale, and the X-axis is the price of the token denominated in the other token.
To buy the black token in the middle it cost 1 white token, and so on.
Buying Tokens on your AMM
Now Alice the neighbour comes with some white tokens and wants to buy some black tokens using your automated market place.
She starts by buying 1 black token, so she has to give your automated market place 1 white token to take out a black token, so your automated market place changes as per below:
Your automated market place now has 6 white tokens and 5 black tokens!
Cool, but Alice now wants to buy more black tokens, well hold on girl, it’s more expensive now!
If she wants to buy 1 more black token, so she has to gives the automated market place 2 white token, because this is the new price of black tokens! So your automated market place changes as per below:
Now, if Alice wants to buy one more black token, then it will cost her 3 white tokens. She wants one more black token, so she swaps her remaining 3 white tokens to buy one more black token, and your automated market place changes as per below:
Now wait for it:
The Wife: “OMG, I have so much more tokens now, I have 11 white tokens and 3 black tokens, that’s 14 tokens in total, 3 more than what I had in the beginning! It’s so easy to make money!”
Now to break her illusion of wealth, I will replace white tokens with dollars and leave the black tokens as it, just plain tokens:
The Shadow of Impermanent Loss
Now comes the toughest part of the game, breaking in the concept of impermanent loss:
Me: What is the last price of a black token?
The Wife: $3
Me: In the beginning you had 5 white tokens and 6 black tokens, and the value of a black token was $1, what was the value of all those tokens?
The Wife: $11
Me: What is the value of all the tokens you have now based on the last price of the black token?
The Wife: 11 white tokens & 3 black tokens, so thats 11 * $1 + 3 * $3 = $20
Me: How much profit did you make?
The Wife: $20 - $11 = $9
Me: If I had 5 white tokens and 6 black tokens too, but kept them in my pocket, how much would my tokens be worth?
The Wife: 5 * $1 + 6 * $3 = $22 ?!?! But how did you make more than me?!?!
Needless to say that the concept of impermanent loss was vaguely understood, I tried a few simulations with Bob who came to sell a whole bunch of black tokens which ended up like this:
So the wife’s automated market place now had 2 white tokens and 15 black tokens, and it was agreed that the price of black token was now $0.25.
The fair value of her tokens were now: 2 * $1 + 15 * $0.25 = $5.75
My imaginary 5 white tokens and 6 black tokens were then worth: 5 * $1 + 6* $0.25 = $6.5, still valued more than the value of her automated market place.
The most important part however was grasping the concept on how a pool of liquidity could by itself suffice in creating a market place without human intervention.
A Pay-to-Use Market Place
While slightly painful, the previous exercise was necessary before I could introduce the slightly more complex concept of fees.
I restarted the game with a fresh game board with one additional rule:
Every time someone swaps tokens on your automated market place they need to pay you a fee which is equivalent to 10% of the notional value of the swap.
We broke out a coin purse and opened the calculator for this round!
Bonus Picture
Takeouts
Liquidity provision is not hard to understand.
Automated market places normally underperform pure holding strategies in the short term because of impermanent loss.
However the addition of fees can change that outlook, especially if there is a lot of volatility.
Merry Christmas, and get yourself ready as we go deeper into Uniswap V3 strategies.