Skip to content

Commit

Permalink
Estimate the prices using a smaller sell order
Browse files Browse the repository at this point in the history
  • Loading branch information
valo committed Jan 29, 2021
1 parent 40e6c09 commit 7e6b473
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def getUSDCPath(token: interface.IERC20, router: interface.UniswapRouterV2):

def priceOf(token: interface.IERC20, router_address: str):
router = interface.UniswapRouterV2(router_address)
return router.getAmountsOut(10 ** token.decimals(), getUSDCPath(token, router))[-1] / 10 ** USDT.decimals()
return router.getAmountsOut(10 ** token.decimals() / 100, getUSDCPath(token, router))[-1] / 10 ** USDT.decimals() * 100

def priceOfUniPair(uni_pair: interface.UniswapPair, router_address: str):
(token0Reserves, token1Reserves, _) = uni_pair.getReserves()
Expand Down

0 comments on commit 7e6b473

Please sign in to comment.