Uniswap is one source of passive income in the Defi space, but how are those returns worked out? How exactly do you make passive income from Uniswap? And what exactly is an impermanent loss? Can you make a loss with Uniswap?
It recently became important because of the price of Ether has gone crazy of the last few weeks:
What does this mean to the DAI/ETH liquidity pool? DAI is a stable coin so by definition as the price of Ether goes up the pool must go down. This is due to arbitragers swapping DAI for cheap Ether, so the quantity of Ether goes down and DAI goes up. This is the impermanent loss and unless we are the arbitragers with flash loan bots running, we also make a loss.
The formula for calculating this impermanent loss is:
impermanent_loss = 2 * sqrt(price_ratio) / (1+price_ratio) — 1
If this ratio changes you’ll get a chart which looks like this:
A 75% increase in the price of Ether is definitely going to affect our stake in the pool.
Let’s take a transaction from a few months ago before the prices went up: https://etherscan.io/tx/0xe8d096e8662fc1d5bccff6743f99888aed1536dd41055d4fdbe4dd7cd46755a7
Some stats are below:
|Date||ETH added||DAI added||ETH:DAI||Price ETH (USD)||Price DAI|
|2020-05-13||1.00||200.00||1 : 200.00||$199.84||$0.99||$399.69||1.00||200.00|
These were sold in two transactions a while ago for a total of $437. Assuming our investor went back to HODL’ing, was it a good decision?
The current total DAI/ETH are here: https://uniswap.info/pair/0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11
The Uniswap ETH/DAI contract is shown on the page https://etherscan.io/address/0xa478c2975ab1ea89e8196811f51a7b7ade33eb11
Selecting “Token Tracker” show the total number of tokens: https://etherscan.io/token/0xa478c2975ab1ea89e8196811f51a7b7ade33eb11#balances.
At the time of writing the pool was $12,158,337, 56,004,538 DAI, 15,306 ETH and 278,214.07 tokens.
Our original transaction had 14.14 tokens (5.08e-5, or around 0.005%). This gives a current total value of $618.03.
If you wave your mouse over various values in etherscan you’ll see DAI=$1.02, (W)ETH = $399.09 and a calculation on Uniswap shows the pool DAI:ETH is 392.3. We can now work out the new DAI/ETH values:
618.02 = 399.09*ETH + 1.02*DAI
Since we know DAI:ETH, the new values are ETH=0.773 and DAI=303. We can now update the table:
|DAI:ETH||Price ETH (USD)||Price DAI|
|2020-08-06||0.777||303||1 : 392.3||$399.09||$1.02||$618.03||15,306||6,004,538|
Our investor has less ETH and more DAI which is expected. So calculating the impermanent loss:
R=392.3/200=1.9615, the impermanent loss is -5.45%.
The reduction to the pool is now ~0.95 of the current pool 0.777*303 = 222.59
Adjusted ETH = sqrt(222.59/392.3) = 0.7532 ETH
Adjusted DAI = sqrt(222.59*392.3) = 295.5 DAI
We’ve lost some value – our invested ETH is now $300.59 and DAI is $301.41 making for a gain after impermanent loss of $602.00.
To compare our HODL price is 1*399.09=$399.09 of ETH and 200*1.02=$204 of DAI making for a total HODL price of $603.09.
Let’s put all of these in:
Our Uniswap investor would have been 3.7% better off (~$15).
Those elusive fees are the current price – the impermanent loss price, which is ~$16 or 4% of the original price.
From this we can deduce that investing in Uniswap is OK as long the fees exceed the impermanent loss.
Go to https://www.uniswaproi.com/ to see how your investments are tracking 🙂