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

SOR - Normalized liquidity & tilted pools #1167

Open
johngrantuk opened this issue Oct 31, 2024 · 2 comments
Open

SOR - Normalized liquidity & tilted pools #1167

johngrantuk opened this issue Oct 31, 2024 · 2 comments
Assignees

Comments

@johngrantuk
Copy link
Member

Hey friends. Found an issue in the SOR algo. The problem is how normalized liquidity is calculated for tokenPairs and that tilted pools can (like gyroE can tilt) mess up the calcs. So if you have a CSP with asset A and asset B with a lot of liquidity and a tilted gyroE pool with asset A and asset B with less liquidity it wont ever consider the CSP pool and not be able to route big trades.
I think the core of the issue is that the ABA method fails to deliver proper results if the pool is tilted and has almost 0.1% of asset A and 99.9% of asset B
I will add a workaround that it will at least continue to consider a second path (the CSP path in the above example) but that only works if there is only one tilted gyro pool for the same pair (which I hope fixes most cases for now).

@brunoguerios brunoguerios self-assigned this Nov 14, 2024
@brunoguerios brunoguerios transferred this issue from balancer/b-sdk Nov 14, 2024
@brunoguerios
Copy link
Member

This is a problem intrinsic to ABA method. In oder to fix this we'll need a new approach.

One idea is to replace ABA with the existing spotPrice calculation (done in the backend), which can be used to calculate priceImpact and NL.

But this feels like a bigger task that should be done after v3 is launched and higher priority tasks are out of the way.

Ps: the current workaround seems to be working as expected, so I believe this is not such a high priority.

@johngrantuk
Copy link
Member Author

This is a problem intrinsic to ABA method. In oder to fix this we'll need a new approach.

One idea is to replace ABA with the existing spotPrice calculation (done in the backend), which can be used to calculate priceImpact and NL.

But this feels like a bigger task that should be done after v3 is launched and higher priority tasks are out of the way.

Ps: the current workaround seems to be working as expected, so I believe this is not such a high priority.

At the onsite Jarek mentioned the possible option of using the API USD total liquidity amount. Not sure if this is valid but worth checking in with him when this task is picked up.

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

2 participants