Cant get price from Uniswap V3 via multiple pools #257
Unanswered
Lossssssss
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Hi, |
Beta Was this translation helpful? Give feedback.
1 reply
-
Well, you could try to use mentioned package locally to get quotes. I'm not an expert, but it seems not that difficult for me to create such interaction via some REST API. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. Firstly, thanks a lot for you work, its great. We managed to track price from Uniswap v2. But with Uni v3 we have a huge issue:
Function get_price_output returns price only from one direct pool. For example, if there are 2 pools WETH/token and USDC/token, function will quote only from one of them. That means that function will return the price not as efficient, as if i buy on Uniswap V3 manually. Function is not using router, i guess.
So, my question is expected: how can i get a price from uniswap v3 with optimal routing? The code below:
address = None # or None if you're not going to make transactions
private_key = None # or None if you're not going to make transactions
version = 3 # specify which version of Uniswap to use
provider = “infura” # can also be set through the environment variable
PROVIDER
uniswap = Uniswap(address=address, private_key=private_key, version=version, provider=provider)
total = {}
usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
coin_to_check = "0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39"
qty = uniswap.get_price_output(usdc,coin_to_check, 1000 * 10 ** 8,fee=3000)
print(qty)
Beta Was this translation helpful? Give feedback.
All reactions