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

Router: add a liquidity endpoint (draft) #2

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

farnyser
Copy link
Contributor

Fetch total liquidity (in US $) of a token reachable through autobahn

This first version compute an estimation of reachable liquidity using existing quoting API and an heuristic (if output stop to grow with input, then it means we reached max available quantity for a pool)
It could be improved by using dex specific code.

Query example (for SOL, USDC, MNGO & WIF):

http://127.0.0.1:8888/liquidity?mints=So11111111111111111111111111111111111111112,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,MangoCzJ36AjZyKwVj3VnYU4GTonjfVEnJmvvWaxLac,EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm

Result:

{
  "liquidity": {
    "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm": 1651150.4687013852,
    "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": 15627441.321525,
    "MangoCzJ36AjZyKwVj3VnYU4GTonjfVEnJmvvWaxLac": 173.31381035204276,
    "So11111111111111111111111111111111111111112": 44315126.80003761
  }
}

@farnyser farnyser requested a review from riordanp September 26, 2024 15:21
Fetch total liquidity (in US $) of a token reachable through autobahn
@farnyser farnyser force-pushed the serge/liquidity-endpoint branch from 645e150 to c8d9b2f Compare September 27, 2024 07:00
@farnyser farnyser merged commit 1bd6d1a into main Oct 1, 2024
6 checks passed
@farnyser farnyser deleted the serge/liquidity-endpoint branch October 1, 2024 08:23
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

Successfully merging this pull request may close these issues.

1 participant