A lot has been said and written about calculating a position’s IL for the “simple” case:
I deposited token0 and token1 amounts at the creation of the position, and now the price is different, and the amounts are different.
Calculating vs. the hodl case is easy:
1. Take the original amount
2. multiple it by the current prices of the tokens
3. Take the current tokens amounts
4. Multiple it by the current prices
5. The difference is your IL
But how do I do it if there were multiple “events” of the position?
In uniswap V3, I can decide to withdraw some of the original deposit (not talking about collecting fees..putting that aside for now as the IL is regardless of the fees. Fees help to “battle” it, but shouldn’t be considered here) and deposit even more to the same position.
This means that my deposited amount can change.
For example:
\* Deposited 1 WETH and 0.008 WBTC (numbers don’t really matter for this discussion)
\* A few days pass, and I deposit yet again another 1 WETH and 0.007 WBTC (the prices changed)
\* A week later, I took out of my position only 30% of the entire position balance (again, ignoring accumulated fees here).
How should that be treated to know my IL?
My current thinking is FIFO, each deposit of funds will be calculated in its own IL, and whenever I withdraw funds, it will be treated in a FIFO approach, which means the 30% I took will be considered to be taken from the FIRST deposit I made until it’s all done. Then I move to the next batch I deposited if 30% is more than the FIRST deposit, and so on.
WDYT? Other suggestions?
Don’t think there’re any platforms that do everything you asked for, but you can check out revert.finance – you can paste your wallet address and check the IL over certain periods, you can also do a dummy test run based on historical data.