zelos-alpha / demeter

Better backtest toolkit for Uniswap v3 and Aave.

Home Page:https://medium.com/zelos-research

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How accurate calculation can be? (uniswap v3 pool)

youbrain opened this issue · comments

commented

How accurate can be the calculation of the commission earned by the uniswap v3 pool? (back test on historical data)

When I run the backtest and compare the result with the results of my real pool, the difference in eth is less than 0.06 percent, but in usdt the difference is 0.428%.
Is it possible to get 1 in 1 exact data?,
and if not, how to get closer to these values?
What is acceptable difference ?

Backtesting runs at minute intervals, which introduces some errors, but also brings some benefits.

  • This approach allows for standardizing the time intervals across different pools.
  • The efficiency of backtesting is much higher compared to replaying each log.

Another potential source of error is when the pool is very small, leading to the virtual liquidity of users dominating a significant portion of the total liquidity in the backtesting.

The third scenario is when the current price is at the edge of a position. There might be slight errors when it moves out or in the range.

Finally, could you share your code so that we can help you review it for any other potential sources of error? Just like this issue