uniswap_v3.utils

Documentation for eth_defi.uniswap_v3.utils Python module.

Uniswap v3 helper functions.

Functions

decode_path(full_path_encoded)

Decodes the path.

encode_path(path, fees[, exact_output])

Encode the routing path to be suitable to use with Quoter and SwapRouter.

encode_sqrt_ratio_x96(*, amount0, amount1)

Returns the sqrt ratio as a Q64.96 corresponding to a given ratio of amount1 and amount0

get_default_tick_range(fee)

Returns min and max tick for a given fee, this is used by default if the pool owner doesn't want to apply concentrated liquidity initially.

get_max_tick(fee)

Returns max tick for given fee.

get_min_tick(fee)

Returns min tick for given fee.

get_nearest_usable_tick(tick, fee)

get_token0_amount_in_range(liquidity, sp, sb)

Returns token0 (base token) amount in a liquidity range

get_token1_amount_in_range(liquidity, sp, sa)

Returns token1 (quote token) amount in a liquidity range

run_graphql_query(query, *[, variables, api_url])

Run query on Uniswap v3 subgraph

tick_to_price(tick)

Returns price corresponding to a tick

tick_to_sqrt_price(tick)

Returns square root price corresponding to a tick