Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cant get price from Uniswap V3 via multiple pools#257

Unanswered
Lossssssss asked this question inQ&A
Discussion options

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 variablePROVIDER
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)

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Hi,
Long story short, implementation is off-chain. There isan API written in TypeScript that provides this feature. Generally speaking, it is possible to port it into Python. However, hardly can I imagine someone would spend time on that.

You must be logged in to vote
1 reply
@Lossssssss
Comment options

Wow, thanks. Hm, yeah, porting from Typescript to Python seems overwhelming(

Means we are a little stuck. We tried to get quotes from 1inch via Node. But 1inch removed this function in new protocol, now its possible to get quotes only via API, and API has a really low limits :(

Comment options

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.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@Lossssssss@liquid-8

[8]ページ先頭

©2009-2025 Movatter.jp