y.prices.dex package

Subpackages

Submodules

y.prices.dex.genericamm module

class y.prices.dex.genericamm.GenericAmm[source]

Bases: ASyncGenericBase

A class for handling generic Automated Market Maker (AMM) Liquidity Pool (LP) tokens.

This class provides methods to interact with and price generic AMM LP token contracts.

__init__(asynchronous=False)[source]

Initialize the GenericAmm instance.

Parameters:

asynchronous (optional) – Whether methods will return coroutines by default. Defaults to False.

Return type:

None

get_price[source]

Get the price of the LP token in USD.

Parameters:
  • lp_token_address (str | HexBytes | AnyAddress | EthAddress | Contract | int) – The address of the LP token.

  • block (optional) – The block number to query. Defaults to None (latest).

  • skip_cache (optional) – Whether to skip cache. Defaults to ENVS.SKIP_CACHE.

Returns:

The price of the LP token in USD.

Return type:

UsdPrice

Example

>>> amm = GenericAmm(asynchronous=True)
>>> address = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
>>> price = await amm.get_price(address)
>>> print(price)
1.0
get_tokens[source]

Get the tokens in the AMM pool.

Args:

lp_token_address: The address of the LP token.

Returns:

A tuple containing the two ERC20 tokens in the pool.

Example:
>>> amm = GenericAmm(asynchronous=True)
>>> address = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
>>> tokens = await amm.get_tokens(address)
>>> print(tokens)
(ERC20(0x123...), ERC20(0x456...))

Since get_tokens is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

lp_token_address (str | HexBytes | AnyAddress | EthAddress | Contract | int)

Return type:

Tuple[ERC20, ERC20]

get_tvl[source]

Get the Total Value Locked (TVL) in the AMM pool.

Parameters:
  • lp_token_address (str | HexBytes | AnyAddress | EthAddress | Contract | int) – The address of the LP token.

  • block (optional) – The block number to query. Defaults to None (latest).

  • skip_cache (optional) – Whether to skip cache. Defaults to ENVS.SKIP_CACHE.

Returns:

The Total Value Locked in USD.

Return type:

UsdValue

Example

>>> amm = GenericAmm(asynchronous=True)
>>> address = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
>>> tvl = await amm.get_tvl(address)
>>> print(tvl)
1000000.0
async y.prices.dex.genericamm.is_generic_amm(lp_token_address)[source]

Check if the given address is a generic AMM LP token.

Parameters:

lp_token_address (str | HexBytes | AnyAddress | EthAddress | Contract | int) – The address to check.

Returns:

True if the address is a generic AMM LP token, False otherwise.

Return type:

bool

Example

>>> address = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
>>> is_amm = await is_generic_amm(address)
>>> print(is_amm)
False
y.prices.dex.genericamm.generic_amm = <y.prices.dex.genericamm.GenericAmm object>

A global instance of GenericAmm with asynchronous mode enabled.

y.prices.dex.mooniswap module

ASyncFunctiony.prices.dex.mooniswap.get_pool_price(token: Union[str, hexbytes.main.HexBytes, ~AnyAddress, brownie.convert.datatypes.EthAddress, brownie.network.contract.Contract, int], block: Union[int, eth_typing.evm.BlockNumber, NoneType] = None, skip_cache: bool = <EnvironmentVariable[name=`YPRICEMAGIC_SKIP_CACHE`, type=bool, default_value=False, current_value=False, using_default=True]>) y.datatypes.UsdPrice[source]

Get the price of the given Mooniswap pool token.

Args:

token: The address of the pool token. block (optional): The block number to get the price at. Defaults to latest block. skip_cache (optional): Whether to skip the cache. Defaults to ENVS.SKIP_CACHE.

Returns:

The price of the pool token in USD.

Since get_pool_price is an ASyncFunctionSyncDefault, you can optionally pass sync=False or asynchronous=True to force it to return a coroutine. Without either kwarg, it will run synchronously.

Parameters:
Return type:

UsdPrice

ASyncFunctiony.prices.dex.mooniswap.is_mooniswap_pool(token: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool[source]

Check if the given token address is a Mooniswap pool.

Args:

token: The address of the token to check.

Returns:

True if the token is a Mooniswap pool, False otherwise.

Since is_mooniswap_pool is an ASyncFunctionSyncDefault, you can optionally pass sync=False or asynchronous=True to force it to return a coroutine. Without either kwarg, it will run synchronously.

Parameters:

token (str | HexBytes | AnyAddress | EthAddress | Contract | int)

Return type:

bool

y.prices.dex.solidly module

class y.prices.dex.solidly.SolidlyPool[source]

Bases: UniswapV2Pool

ASyncFunction_decimals(block: int | eth_typing.evm.BlockNumber | NoneType = None) int

used to fetch decimals at specific block

Since _decimals is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

block (int | BlockNumber | None)

Return type:

int

ASyncFunction_scale(block: int | eth_typing.evm.BlockNumber | NoneType = None) int

Since _scale is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

block (int | BlockNumber | None)

Return type:

int

__eq__(_ContractBase__o)

Return self==value.

Parameters:

_ContractBase__o (object)

Return type:

bool

__init__(address, token0=None, token1=None, deploy_block=None, asynchronous=False)
Parameters:
__str__()

Return str(self).

Return type:

str

__build_name__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__decimals__: HiddenMethodDescriptor[Self, int]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__factory__: HiddenMethodDescriptor[Self, str | HexBytes | AnyAddress | EthAddress]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__name__: HiddenMethodDescriptor[Self, str] = 'SolidlyPool'
__scale__: HiddenMethodDescriptor[Self, int]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__symbol__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__token0__: HiddenMethodDescriptor[Self, ERC20]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__token1__: HiddenMethodDescriptor[Self, ERC20]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__tokens__: HiddenMethodDescriptor[Self, Tuple[ERC20, ERC20]]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

address
asynchronous: bool = False
balance_of
Parameters:
Return type:

int

balance_of_readable
Parameters:
Return type:

float

build_name
check_liquidity

Check the liquidity of a specific token in the pool at a given block.

Args:

token: The address of the token to check. block: The block number to query.

Returns:

The liquidity of the token in the pool.

Raises:

TokenNotFound: If the token is not one of the two tokens in the liquidity pool.

Since check_liquidity is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

int

property contract: Contract
decimals
deploy_block: ASyncBoundMethod[Self, Any, int]
Parameters:

when_no_history_return_0 (bool)

Return type:

int

factory
get_price

Since get_price is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UsdPrice | None

get_reserves
get_token_out

Since get_token_out is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

token_in (str | HexBytes | AnyAddress | EthAddress)

Return type:

ERC20

has_method
Parameters:
  • method (str)

  • return_response (bool)

Return type:

bool | Any

is_uniswap_pool

Check if this contract is a valid liquidity pool for Uniswap V2 or one of its forks.

Parameters:

block (optional) – The block number to query. Defaults to latest block.

Returns:

True if the contract is a valid Uniswap V2 pool, False otherwise.

Return type:

bool

name
price
Parameters:
Return type:

UsdPrice | None

reserves
Parameters:

block (int | BlockNumber | None)

Return type:

Tuple[WeiBalance, WeiBalance] | None

scale
symbol
token0
token1
tokens
total_supply
Parameters:

block (int | BlockNumber | None)

Return type:

int

total_supply_readable
Parameters:

block (int | BlockNumber | None)

Return type:

float

tvl
Parameters:
Return type:

Decimal | None

class y.prices.dex.solidly.SolidlyRouter[source]

Bases: SolidlyRouterBase

__eq__(_ContractBase__o)

Return self==value.

Parameters:

_ContractBase__o (object)

Return type:

bool

__init__(router_address, *args, **kwargs)
Parameters:
Return type:

None

__str__()

Return str(self).

Return type:

str

pools_for_token(token_address, block=None, _ignore_pools=())
Parameters:
Return type:

AsyncIterator[UniswapV2Pool]

__build_name__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__pools__: HiddenMethodDescriptor[Self, List[UniswapV2Pool]]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

address
asynchronous: bool = False
build_name
check_liquidity

Since check_liquidity is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

int

property contract: Contract
deepest_pool

returns the deepest pool for token_address at block, excluding pools in _ignore_pools

Since deepest_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

deepest_pool_for

Since deepest_pool_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

Tuple[str | HexBytes | AnyAddress | EthAddress, int]

deepest_stable_pool

returns the deepest pool for token_address at block which has token_address paired with a stablecoin, excluding pools in _ignore_pools

Since deepest_stable_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

deploy_block: ASyncBoundMethod[Self, Any, int]
Parameters:

when_no_history_return_0 (bool)

Return type:

int

get_path_to_stables

Since get_path_to_stables is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

List[str | HexBytes | AnyAddress | EthAddress | Contract]

get_pool[source]

Since get_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

SolidlyPool | None

get_pools_for

Since get_pools_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

Dict[UniswapV2Pool, str | HexBytes | AnyAddress | EthAddress]

get_price
Calculate a price based on Uniswap Router quote for selling one token_in.

Always uses intermediate WETH pair if [token_in,weth,token_out] swap path available.

Since get_price is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UsdPrice | None

get_quote
Parameters:
Return type:

Tuple[int, int]

get_routes_from_path[source]
Parameters:
Return type:

List[Tuple[str | HexBytes | AnyAddress | EthAddress, str | HexBytes | AnyAddress | EthAddress, bool]]

has_method
Parameters:
  • method (str)

  • return_response (bool)

Return type:

bool | Any

pair_for[source]

Since pair_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

str | HexBytes | AnyAddress | EthAddress

pools
class y.prices.dex.solidly.SolidlyRouterBase[source]

Bases: UniswapRouterV2

Solidly is a modified fork of Uni V2. The uniswap_multiplexer is the entrypoint for pricing using this object.

__eq__(_ContractBase__o)

Return self==value.

Parameters:

_ContractBase__o (object)

Return type:

bool

__init__(router_address, *args, **kwargs)
Parameters:
Return type:

None

__str__()

Return str(self).

Return type:

str

pools_for_token(token_address, block=None, _ignore_pools=())
Parameters:
Return type:

AsyncIterator[UniswapV2Pool]

__build_name__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__pools__: HiddenMethodDescriptor[Self, List[UniswapV2Pool]]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

address
asynchronous: bool = False
build_name
check_liquidity

Since check_liquidity is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

int

property contract: Contract
deepest_pool

returns the deepest pool for token_address at block, excluding pools in _ignore_pools

Since deepest_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

deepest_pool_for

Since deepest_pool_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

Tuple[str | HexBytes | AnyAddress | EthAddress, int]

deepest_stable_pool

returns the deepest pool for token_address at block which has token_address paired with a stablecoin, excluding pools in _ignore_pools

Since deepest_stable_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

deploy_block: ASyncBoundMethod[Self, Any, int]
Parameters:

when_no_history_return_0 (bool)

Return type:

int

get_path_to_stables

Since get_path_to_stables is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

List[str | HexBytes | AnyAddress | EthAddress | Contract]

get_pools_for

Since get_pools_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

Dict[UniswapV2Pool, str | HexBytes | AnyAddress | EthAddress]

get_price
Calculate a price based on Uniswap Router quote for selling one token_in.

Always uses intermediate WETH pair if [token_in,weth,token_out] swap path available.

Since get_price is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UsdPrice | None

get_quote[source]
Parameters:
Return type:

Tuple[int, int]

has_method
Parameters:
  • method (str)

  • return_response (bool)

Return type:

bool | Any

pools

y.prices.dex.velodrome module

exception y.prices.dex.velodrome.NoReservesError[source]

Bases: Exception

class y.prices.dex.velodrome.VelodromePool[source]

Bases: UniswapV2Pool

ASyncFunction_decimals(block: int | eth_typing.evm.BlockNumber | NoneType = None) int

used to fetch decimals at specific block

Since _decimals is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

block (int | BlockNumber | None)

Return type:

int

ASyncFunction_scale(block: int | eth_typing.evm.BlockNumber | NoneType = None) int

Since _scale is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

block (int | BlockNumber | None)

Return type:

int

__eq__(_ContractBase__o)

Return self==value.

Parameters:

_ContractBase__o (object)

Return type:

bool

__init__(address, token0=None, token1=None, stable=None, deploy_block=None, asynchronous=False)[source]
Parameters:
__str__()

Return str(self).

Return type:

str

__build_name__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__decimals__: HiddenMethodDescriptor[Self, int]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__factory__: HiddenMethodDescriptor[Self, str | HexBytes | AnyAddress | EthAddress]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__name__: HiddenMethodDescriptor[Self, str] = 'VelodromePool'
__scale__: HiddenMethodDescriptor[Self, int]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__symbol__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__token0__: HiddenMethodDescriptor[Self, ERC20]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__token1__: HiddenMethodDescriptor[Self, ERC20]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__tokens__: HiddenMethodDescriptor[Self, Tuple[ERC20, ERC20]]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

address
asynchronous: bool = False
balance_of
Parameters:
Return type:

int

balance_of_readable
Parameters:
Return type:

float

build_name
check_liquidity

Check the liquidity of a specific token in the pool at a given block.

Args:

token: The address of the token to check. block: The block number to query.

Returns:

The liquidity of the token in the pool.

Raises:

TokenNotFound: If the token is not one of the two tokens in the liquidity pool.

Since check_liquidity is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

int

property contract: Contract
decimals
deploy_block: ASyncBoundMethod[Self, Any, int]
Parameters:

when_no_history_return_0 (bool)

Return type:

int

factory
get_price

Since get_price is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UsdPrice | None

get_reserves
get_token_out

Since get_token_out is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:

token_in (str | HexBytes | AnyAddress | EthAddress)

Return type:

ERC20

has_method
Parameters:
  • method (str)

  • return_response (bool)

Return type:

bool | Any

is_stable
is_uniswap_pool

Check if this contract is a valid liquidity pool for Uniswap V2 or one of its forks.

Parameters:

block (optional) – The block number to query. Defaults to latest block.

Returns:

True if the contract is a valid Uniswap V2 pool, False otherwise.

Return type:

bool

name
price
Parameters:
Return type:

UsdPrice | None

reserves
Parameters:

block (int | BlockNumber | None)

Return type:

Tuple[WeiBalance, WeiBalance] | None

scale
symbol
token0
token1
tokens
total_supply
Parameters:

block (int | BlockNumber | None)

Return type:

int

total_supply_readable
Parameters:

block (int | BlockNumber | None)

Return type:

float

tvl
Parameters:
Return type:

Decimal | None

class y.prices.dex.velodrome.VelodromeRouterV2[source]

Bases: SolidlyRouterBase

__eq__(_ContractBase__o)

Return self==value.

Parameters:

_ContractBase__o (object)

Return type:

bool

__init__(*args, **kwargs)[source]
Return type:

None

__str__()

Return str(self).

Return type:

str

pools_for_token(token_address, block=None, _ignore_pools=())
Parameters:
Return type:

AsyncIterator[UniswapV2Pool]

__build_name__: HiddenMethodDescriptor[Self, str]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

__pools__: HiddenMethodDescriptor[Self, Set[VelodromePool]]

A HiddenMethodDescriptor for _ASyncPropertyDescriptorBase.get().

Parameters:
  • instance (I)

  • owner (Type[I] | None)

Return type:

T

address
asynchronous: bool = False
build_name
check_liquidity

Since check_liquidity is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

int

property contract: Contract
deepest_pool

returns the deepest pool for token_address at block, excluding pools in _ignore_pools

Since deepest_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

deepest_pool_for

Since deepest_pool_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

Tuple[str | HexBytes | AnyAddress | EthAddress, int]

deepest_stable_pool

returns the deepest pool for token_address at block which has token_address paired with a stablecoin, excluding pools in _ignore_pools

Since deepest_stable_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

deploy_block: ASyncBoundMethod[Self, Any, int]
Parameters:

when_no_history_return_0 (bool)

Return type:

int

get_path_to_stables

Since get_path_to_stables is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

List[str | HexBytes | AnyAddress | EthAddress | Contract]

get_pool[source]

Since get_pool is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UniswapV2Pool | None

get_pools_for

Since get_pools_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

Dict[UniswapV2Pool, str | HexBytes | AnyAddress | EthAddress]

get_price
Calculate a price based on Uniswap Router quote for selling one token_in.

Always uses intermediate WETH pair if [token_in,weth,token_out] swap path available.

Since get_price is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

UsdPrice | None

get_quote
Parameters:
Return type:

Tuple[int, int]

get_routes_from_path[source]
Parameters:
Return type:

List[Tuple[str | HexBytes | AnyAddress | EthAddress, str | HexBytes | AnyAddress | EthAddress, bool]]

has_method
Parameters:
  • method (str)

  • return_response (bool)

Return type:

bool | Any

pool_for[source]

Since pool_for is an ASyncFunctionAsyncDefault, you can optionally pass sync=True or asynchronous=False to force it to run synchronously and return a value. Without either kwarg, it will return a coroutine for you to await.

Parameters:
Return type:

str | HexBytes | AnyAddress | EthAddress | None

pools[source]
async y.prices.dex.velodrome.is_contract(pool_address)[source]
Parameters:

pool_address (str | HexBytes | AnyAddress | EthAddress)

Return type:

bool

Module contents