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

Price input and price output don't match#258

MNwake started this conversation inGeneral
Discussion options

Anyone know why the price input and price output of the exact same coins of the same amount don't match? just trying to understand so I don't make an error in my code. Thanks!

 from uniswap import Uniswapaddress = None        # or None if you're not going to make transactionsprivate_key = None  # or None if you're not going to make transactionsversion3 = 3  version2 = 2                     # specify which version of Uniswap to useprovider = INFURA_API    # can also be set through the environment variable `PROVIDER`uni3 = Uniswap(address=address, private_key=private_key, version=version3, provider=provider)uni2 = Uniswap(address=address, private_key=private_key, version=version2, provider=provider)amount = 1 print(token0id) # USDC print(token1id) # WETHprint(uni3.get_price_input(token1id, token0id, 10^18)/1000000)print(uni2.get_price_input(token1id, token0id, 10^18)/1000000)print(uni3.get_price_output(token0id, token1id, amount)/1000000)print(uni2.get_price_output(token0id, token1id, amount)/1000000)

print result:

0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
1802.351073
1797.193508
1813.226675
1808.107812

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
1 participant
@MNwake

[8]ページ先頭

©2009-2025 Movatter.jp