y.prices.tokenized_fund package
Submodules
y.prices.tokenized_fund.basketdao module
- ASyncFunctiony.prices.tokenized_fund.basketdao.get_price(address: brownie.convert.datatypes.EthAddress, 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 a BasketDAO token in USD.
- Args:
address: The address of the BasketDAO token. block (optional): The block number to query. Defaults to None (latest). skip_cache (optional): Whether to bypass the disk cache. Defaults to
ENVS.SKIP_CACHE
.- Returns:
The price of the BasketDAO token in USD.
- Raises:
PriceError: If unable to fetch the price.
- Example:
>>> price = get_price("0x0ac58Df435D3dC9F6e079B2C5F358A4b7e861B69") >>> print(price) 1.05
Since get_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:
address (EthAddress)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- ASyncFunctiony.prices.tokenized_fund.basketdao.is_basketdao_index(address: brownie.convert.datatypes.EthAddress) bool [source]
Check if the given token is a BasketDAO token.
- Args:
address: The address of the token to check.
- Returns:
True if the token is a BasketDAO token, False otherwise.
- Example:
>>> is_bd = is_basketdao("0x0ac58Df435D3dC9F6e079B2C5F358A4b7e861B69") >>> print(is_bd) True
Since is_basketdao_index 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:
address (EthAddress)
- Return type:
y.prices.tokenized_fund.gelato module
- ASyncFunctiony.prices.tokenized_fund.gelato.get_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]
Since get_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:
token (str | HexBytes | AnyAddress | EthAddress | Contract | int)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- ASyncFunctiony.prices.tokenized_fund.gelato.is_gelato_pool(token_address: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool [source]
Since is_gelato_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_address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
- Return type:
y.prices.tokenized_fund.piedao module
- async y.prices.tokenized_fund.piedao.get_balance(bpool, token, block=None)[source]
- Parameters:
bpool (str | HexBytes | AnyAddress | EthAddress)
token (ERC20)
block (int | BlockNumber | None)
- Return type:
- async y.prices.tokenized_fund.piedao.get_bpool(pie_address, block=None)[source]
- Parameters:
pie_address (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber | None)
- Return type:
str | HexBytes | AnyAddress | EthAddress
- ASyncFunctiony.prices.tokenized_fund.piedao.get_price(pie: 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]
Since get_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:
pie (str | HexBytes | AnyAddress | EthAddress | Contract | int)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- async y.prices.tokenized_fund.piedao.get_tokens(pie_address, block=None)[source]
- Parameters:
pie_address (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber | None)
- Return type:
- async y.prices.tokenized_fund.piedao.get_tvl(pie_address, block=None, skip_cache=<EnvironmentVariable[name=`YPRICEMAGIC_SKIP_CACHE`, type=bool, default_value=False, current_value=False, using_default=True]>)[source]
- Parameters:
pie_address (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- async y.prices.tokenized_fund.piedao.get_value(bpool, token, block=None, skip_cache=<EnvironmentVariable[name=`YPRICEMAGIC_SKIP_CACHE`, type=bool, default_value=False, current_value=False, using_default=True]>)[source]
- Parameters:
bpool (str | HexBytes | AnyAddress | EthAddress)
token (ERC20)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- ASyncFunctiony.prices.tokenized_fund.piedao.is_pie(token: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool [source]
Since is_pie 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:
y.prices.tokenized_fund.reserve module
- ASyncFunctiony.prices.tokenized_fund.reserve.get_price(token_address: Union[str, hexbytes.main.HexBytes, ~AnyAddress, brownie.convert.datatypes.EthAddress], 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]>) decimal.Decimal [source]
Get the price of a Reserve Protocol R-token in USD.
- Args:
token_address: The address of the R-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 R-token in USD.
- Raises:
TypeError: If the token is not a valid R-token. Exception: If unable to calculate the price.
- Example:
>>> address = "0xaCeeD87BD5754c3d714F3Bd43a9B7B0C9250ab0D" # RSV token >>> price = await get_price(address, sync=False) >>> print(price) 1.00
Since get_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:
token_address (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- ASyncFunctiony.prices.tokenized_fund.reserve.is_rtoken(token_address: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress) bool [source]
Check if the given token is a Reserve Protocol R-token.
- Args:
token_address: The address of the token to check.
- Returns:
True if the token is a Reserve Protocol R-token, False otherwise.
- Example:
>>> address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" # USDC (not an R-token) >>> is_r = is_rtoken(address) >>> print(is_r) False
Since is_rtoken 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_address (str | HexBytes | AnyAddress | EthAddress)
- Return type:
y.prices.tokenized_fund.tokensets module
- class y.prices.tokenized_fund.tokensets.TokenSet[source]
Bases:
ERC20
- 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:
- 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:
- __eq__(_ContractBase__o)
Return self==value.
- __init__(address, asynchronous=False)[source]
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
asynchronous (bool)
- __build_name__: HiddenMethodDescriptor[Self, str]
A
HiddenMethodDescriptor
for_ASyncPropertyDescriptorBase.get()
.
- __decimals__: HiddenMethodDescriptor[Self, int]
A
HiddenMethodDescriptor
for_ASyncPropertyDescriptorBase.get()
.
- __name__: HiddenMethodDescriptor[Self, str] = 'TokenSet'
- __scale__: HiddenMethodDescriptor[Self, int]
A
HiddenMethodDescriptor
for_ASyncPropertyDescriptorBase.get()
.
- __symbol__: HiddenMethodDescriptor[Self, str]
A
HiddenMethodDescriptor
for_ASyncPropertyDescriptorBase.get()
.
- address
- balance_of
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
block (int | BlockNumber | None)
- Return type:
- balance_of_readable
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
block (int | BlockNumber | None)
- Return type:
- balances[source]
- Parameters:
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- build_name
- components[source]
Since components 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:
- decimals
- get_price[source]
- Parameters:
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- name
- price
- Parameters:
block (int | BlockNumber | None)
return_None_on_failure (bool)
skip_cache (bool)
ignore_pools (Tuple[UniswapV2Pool | CurvePool, ...])
- Return type:
UsdPrice | None
- scale
- symbol
- total_supply
- Parameters:
block (int | BlockNumber | None)
- Return type:
- total_supply_readable
- Parameters:
block (int | BlockNumber | None)
- Return type:
- ASyncFunctiony.prices.tokenized_fund.tokensets.get_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]
Since get_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:
token (str | HexBytes | AnyAddress | EthAddress | Contract | int)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- ASyncFunctiony.prices.tokenized_fund.tokensets.is_token_set(token: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool [source]
Since is_token_set 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: