UniswapV3PriceHelper
Documentation for eth_defi.uniswap_v3.price.UniswapV3PriceHelper Python class.
- class UniswapV3PriceHelper[source]
Methods summary
__init__
(uniswap_v3)get_amount_in
(amount_out, path, fees, *[, ...])Get how much token we are going to spend.
get_amount_out
(amount_in, path, fees, *[, ...])Get how much token we are going to receive.
validate_args
(path, fees, slippage, amount)- __init__(uniswap_v3)[source]
- Parameters
uniswap_v3 (eth_defi.uniswap_v3.deployment.UniswapV3Deployment) –
- get_amount_out(amount_in, path, fees, *, slippage=0)[source]
Get how much token we are going to receive.
Example:
# Estimate how much DAI we will receive for 1000 WETH # using the route of 2 pools: WETH/USDC 0.3% and USDC/DAI 1% # with slippage tolerance is 0.5% price_helper = UniswapV3PriceHelper(uniswap_v3_deployment) amount_out = price_helper.get_amount_out( 1000, [ weth.address, usdc.address, dai.address, ], [ 3000, 10000, ], slippage=50, )