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:
Return type:

UsdPrice

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:

bool

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:
Return type:

UsdPrice

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:

bool

y.prices.tokenized_fund.piedao module

async y.prices.tokenized_fund.piedao.get_balance(bpool, token, block=None)[source]
Parameters:
Return type:

Decimal

async y.prices.tokenized_fund.piedao.get_bpool(pie_address, block=None)[source]
Parameters:
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:
Return type:

UsdPrice

async y.prices.tokenized_fund.piedao.get_tokens(pie_address, block=None)[source]
Parameters:
Return type:

List[ERC20]

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:
Return type:

UsdValue

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:
Return type:

UsdValue

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:

bool

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:
Return type:

Decimal

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:

bool

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:

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, 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

__name__: HiddenMethodDescriptor[Self, str] = 'TokenSet'
__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

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

int

balance_of_readable
Parameters:
Return type:

float

balances[source]
Parameters:
Return type:

List[WeiBalance]

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:

List[ERC20]

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

when_no_history_return_0 (bool)

Return type:

int

get_price[source]
Parameters:
Return type:

UsdPrice

has_method
Parameters:
  • method (str)

  • return_response (bool)

Return type:

bool | Any

name
price
Parameters:
Return type:

UsdPrice | None

scale
symbol
total_supply
Parameters:

block (int | BlockNumber | None)

Return type:

int

total_supply_readable
Parameters:

block (int | BlockNumber | None)

Return type:

float

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:
Return type:

UsdPrice

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:

bool

Module contents