Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative Liquidity Gross #213

Open
DanieleMDiNosse opened this issue Jun 28, 2024 · 3 comments
Open

Negative Liquidity Gross #213

DanieleMDiNosse opened this issue Jun 28, 2024 · 3 comments

Comments

@DanieleMDiNosse
Copy link

I observed that in certain pools, such as USDC/WETH .05% ('0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'), the liquidity gross column generated by first using create_tick_delta_csv and then create_tick_csv displays negative values. According to my knowledge of Uniswap v3's functionality, this should not be possible.

@miohtama
Copy link
Contributor

Good spot.

We have not deeply vetted the code, so if you have insight what is causing this we are happy to fix.

@hieuh25
Copy link
Contributor

hieuh25 commented Aug 21, 2024

I observed that in certain pools, such as USDC/WETH .05% ('0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'), the liquidity gross column generated by first using create_tick_delta_csv and then create_tick_csv displays negative values. According to my knowledge of Uniswap v3's functionality, this should not be possible.

It all comes down to what is the range of events you have.

Breaking down the functionality of each function:

  • create_tick_delta_csv() basically outputs all the mint and burn events and tick range of each
  • create_tick_csv() uses data from tick delta to aggregate to have the liquidity delta, hence the name of the column is liquidity_gross_delta, not liquidity_gross

So both functions above don't handle the fetching part of the source data: events. If your source data (events) only contains events in a certain range of blocks in history, then liquidity delta is possible to be negative (more burns than mints)

@DanieleMDiNosse
Copy link
Author

I observed that in certain pools, such as USDC/WETH .05% ('0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640'), the liquidity gross column generated by first using create_tick_delta_csv and then create_tick_csv displays negative values. According to my knowledge of Uniswap v3's functionality, this should not be possible.

It all comes down to what is the range of events you have.

Breaking down the functionality of each function:

  • create_tick_delta_csv() basically outputs all the mint and burn events and tick range of each
  • create_tick_csv() uses data from tick delta to aggregate to have the liquidity delta, hence the name of the column is liquidity_gross_delta, not liquidity_gross

So both functions above don't handle the fetching part of the source data: events. If your source data (events) only contains events in a certain range of blocks in history, then liquidity delta is possible to be negative (more burns than mints)

I downloaded all the data since the first Uniswap V3 block via the official tutorial. If I am the only one that is experiencing this issue, I do not exclude the possibility that it can be a data fetching problem due to the Ethereum node. I will try using different sources and I will update this discussion.

If anyone has some other insight, please share it with us!

Good spot.

We have not deeply vetted the code, so if you have insight what is causing this we are happy to fix.

Of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants