y.prices package
Subpackages
- y.prices.dex package
- Subpackages
- Submodules
- y.prices.dex.genericamm module
- y.prices.dex.mooniswap module
- y.prices.dex.solidly module
SolidlyPool
SolidlyPool._decimals
SolidlyPool._scale
SolidlyPool.__eq__()
SolidlyPool.__init__()
SolidlyPool.__str__()
SolidlyPool.__build_name__
SolidlyPool.__decimals__
SolidlyPool.__factory__
SolidlyPool.__name__
SolidlyPool.__scale__
SolidlyPool.__symbol__
SolidlyPool.__token0__
SolidlyPool.__token1__
SolidlyPool.__tokens__
SolidlyPool.address
SolidlyPool.asynchronous
SolidlyPool.balance_of
SolidlyPool.balance_of_readable
SolidlyPool.build_name
SolidlyPool.check_liquidity
SolidlyPool.contract
SolidlyPool.decimals
SolidlyPool.deploy_block
SolidlyPool.factory
SolidlyPool.get_price
SolidlyPool.get_reserves
SolidlyPool.get_token_out
SolidlyPool.has_method
SolidlyPool.is_uniswap_pool
SolidlyPool.name
SolidlyPool.price
SolidlyPool.reserves
SolidlyPool.scale
SolidlyPool.symbol
SolidlyPool.token0
SolidlyPool.token1
SolidlyPool.tokens
SolidlyPool.total_supply
SolidlyPool.total_supply_readable
SolidlyPool.tvl
SolidlyRouter
SolidlyRouter.__eq__()
SolidlyRouter.__init__()
SolidlyRouter.__str__()
SolidlyRouter.pools_for_token()
SolidlyRouter.__build_name__
SolidlyRouter.__pools__
SolidlyRouter.address
SolidlyRouter.asynchronous
SolidlyRouter.build_name
SolidlyRouter.check_liquidity
SolidlyRouter.contract
SolidlyRouter.deepest_pool
SolidlyRouter.deepest_pool_for
SolidlyRouter.deepest_stable_pool
SolidlyRouter.deploy_block
SolidlyRouter.get_path_to_stables
SolidlyRouter.get_pool
SolidlyRouter.get_pools_for
SolidlyRouter.get_price
SolidlyRouter.get_quote
SolidlyRouter.get_routes_from_path
SolidlyRouter.has_method
SolidlyRouter.pair_for
SolidlyRouter.pools
SolidlyRouterBase
SolidlyRouterBase.__eq__()
SolidlyRouterBase.__init__()
SolidlyRouterBase.__str__()
SolidlyRouterBase.pools_for_token()
SolidlyRouterBase.__build_name__
SolidlyRouterBase.__pools__
SolidlyRouterBase.address
SolidlyRouterBase.asynchronous
SolidlyRouterBase.build_name
SolidlyRouterBase.check_liquidity
SolidlyRouterBase.contract
SolidlyRouterBase.deepest_pool
SolidlyRouterBase.deepest_pool_for
SolidlyRouterBase.deepest_stable_pool
SolidlyRouterBase.deploy_block
SolidlyRouterBase.get_path_to_stables
SolidlyRouterBase.get_pools_for
SolidlyRouterBase.get_price
SolidlyRouterBase.get_quote
SolidlyRouterBase.has_method
SolidlyRouterBase.pools
- y.prices.dex.velodrome module
NoReservesError
VelodromePool
VelodromePool._decimals
VelodromePool._scale
VelodromePool.__eq__()
VelodromePool.__init__()
VelodromePool.__str__()
VelodromePool.__build_name__
VelodromePool.__decimals__
VelodromePool.__factory__
VelodromePool.__name__
VelodromePool.__scale__
VelodromePool.__symbol__
VelodromePool.__token0__
VelodromePool.__token1__
VelodromePool.__tokens__
VelodromePool.address
VelodromePool.asynchronous
VelodromePool.balance_of
VelodromePool.balance_of_readable
VelodromePool.build_name
VelodromePool.check_liquidity
VelodromePool.contract
VelodromePool.decimals
VelodromePool.deploy_block
VelodromePool.factory
VelodromePool.get_price
VelodromePool.get_reserves
VelodromePool.get_token_out
VelodromePool.has_method
VelodromePool.is_stable
VelodromePool.is_uniswap_pool
VelodromePool.name
VelodromePool.price
VelodromePool.reserves
VelodromePool.scale
VelodromePool.symbol
VelodromePool.token0
VelodromePool.token1
VelodromePool.tokens
VelodromePool.total_supply
VelodromePool.total_supply_readable
VelodromePool.tvl
VelodromeRouterV2
VelodromeRouterV2.__eq__()
VelodromeRouterV2.__init__()
VelodromeRouterV2.__str__()
VelodromeRouterV2.pools_for_token()
VelodromeRouterV2.__build_name__
VelodromeRouterV2.__pools__
VelodromeRouterV2.address
VelodromeRouterV2.asynchronous
VelodromeRouterV2.build_name
VelodromeRouterV2.check_liquidity
VelodromeRouterV2.contract
VelodromeRouterV2.deepest_pool
VelodromeRouterV2.deepest_pool_for
VelodromeRouterV2.deepest_stable_pool
VelodromeRouterV2.deploy_block
VelodromeRouterV2.get_path_to_stables
VelodromeRouterV2.get_pool
VelodromeRouterV2.get_pools_for
VelodromeRouterV2.get_price
VelodromeRouterV2.get_quote
VelodromeRouterV2.get_routes_from_path
VelodromeRouterV2.has_method
VelodromeRouterV2.pool_for
VelodromeRouterV2.pools
is_contract()
- Module contents
- y.prices.eth_derivs package
- y.prices.lending package
- Submodules
- y.prices.lending.aave module
AaveMarketBase
AaveMarketBase.__contains__()
AaveMarketBase.__eq__()
AaveMarketBase.__init__()
AaveMarketBase.__str__()
AaveMarketBase.__atokens__
AaveMarketBase.__build_name__
AaveMarketBase.address
AaveMarketBase.asynchronous
AaveMarketBase.atokens
AaveMarketBase.build_name
AaveMarketBase.contains
AaveMarketBase.contract
AaveMarketBase.deploy_block
AaveMarketBase.get_reserve_data
AaveMarketBase.get_reserves
AaveMarketBase.has_method
AaveMarketBase.underlying
AaveMarketV1
AaveMarketV1.__contains__()
AaveMarketV1.__eq__()
AaveMarketV1.__init__()
AaveMarketV1.__str__()
AaveMarketV1.__atokens__
AaveMarketV1.__build_name__
AaveMarketV1.address
AaveMarketV1.asynchronous
AaveMarketV1.atokens
AaveMarketV1.build_name
AaveMarketV1.contains
AaveMarketV1.contract
AaveMarketV1.deploy_block
AaveMarketV1.get_reserve_data
AaveMarketV1.get_reserves
AaveMarketV1.has_method
AaveMarketV1.underlying
AaveMarketV2
AaveMarketV2.__contains__()
AaveMarketV2.__eq__()
AaveMarketV2.__init__()
AaveMarketV2.__str__()
AaveMarketV2.__atokens__
AaveMarketV2.__build_name__
AaveMarketV2.address
AaveMarketV2.asynchronous
AaveMarketV2.atokens
AaveMarketV2.build_name
AaveMarketV2.contains
AaveMarketV2.contract
AaveMarketV2.deploy_block
AaveMarketV2.get_reserve_data
AaveMarketV2.get_reserves
AaveMarketV2.has_method
AaveMarketV2.underlying
AaveMarketV3
AaveMarketV3.__contains__()
AaveMarketV3.__eq__()
AaveMarketV3.__init__()
AaveMarketV3.__str__()
AaveMarketV3.__atokens__
AaveMarketV3.__build_name__
AaveMarketV3.address
AaveMarketV3.asynchronous
AaveMarketV3.atokens
AaveMarketV3.build_name
AaveMarketV3.contains
AaveMarketV3.contract
AaveMarketV3.deploy_block
AaveMarketV3.get_reserve_data
AaveMarketV3.get_reserves
AaveMarketV3.has_method
AaveMarketV3.underlying
AaveRegistry
AaveRegistry.__contains__()
AaveRegistry.__init__()
AaveRegistry.__pools__
AaveRegistry.__pools_v1__
AaveRegistry.__pools_v2__
AaveRegistry.__pools_v3__
AaveRegistry.get_price
AaveRegistry.get_price_wrapped_v2
AaveRegistry.get_price_wrapped_v3
AaveRegistry.is_atoken
AaveRegistry.is_wrapped_atoken_v2
AaveRegistry.is_wrapped_atoken_v3
AaveRegistry.pool_for_atoken
AaveRegistry.pools
AaveRegistry.pools_v1
AaveRegistry.pools_v2
AaveRegistry.pools_v3
AaveRegistry.underlying
- y.prices.lending.compound module
CToken
CToken._decimals
CToken._scale
CToken.__eq__()
CToken.__init__()
CToken.__str__()
CToken.__build_name__
CToken.__decimals__
CToken.__name__
CToken.__scale__
CToken.__symbol__
CToken.__underlying__
CToken.address
CToken.asynchronous
CToken.balance_of
CToken.balance_of_readable
CToken.build_name
CToken.contract
CToken.decimals
CToken.deploy_block
CToken.exchange_rate
CToken.get_price
CToken.get_underlying_price
CToken.has_method
CToken.name
CToken.price
CToken.scale
CToken.symbol
CToken.total_supply
CToken.total_supply_readable
CToken.underlying
CToken.underlying_per_ctoken
Compound
Comptroller
Comptroller.__contains__()
Comptroller.__eq__()
Comptroller.__init__()
Comptroller.__str__()
Comptroller.__build_name__
Comptroller.__markets__
Comptroller.address
Comptroller.asynchronous
Comptroller.build_name
Comptroller.contract
Comptroller.deploy_block
Comptroller.has_method
Comptroller.markets
Comptroller.oracle
- y.prices.lending.ib module
- Module contents
- y.prices.stable_swap package
- Submodules
- y.prices.stable_swap.belt module
- y.prices.stable_swap.curve module
AddressProvider
AddressProvider.__await__()
AddressProvider.__eq__()
AddressProvider.__init__()
AddressProvider.__str__()
AddressProvider.__build_name__
AddressProvider.address
AddressProvider.asynchronous
AddressProvider.build_name
AddressProvider.contract
AddressProvider.deploy_block
AddressProvider.get_registry
AddressProvider.has_method
AddressProvider.identifiers
AddressProvider.loaded
AddressProviderEvents
AddressProviderEvents.obj_type
AddressProviderEvents.__aiter__()
AddressProviderEvents.__await__()
AddressProviderEvents.__del__()
AddressProviderEvents.__init__()
AddressProviderEvents.__iter__()
AddressProviderEvents.__subclasshook__()
AddressProviderEvents._objects_thru()
AddressProviderEvents.events()
AddressProviderEvents.filter()
AddressProviderEvents.logs()
AddressProviderEvents.objects()
AddressProviderEvents.sort()
AddressProviderEvents.wrap()
AddressProviderEvents.__async_property__
AddressProviderEvents.__orig_bases__
AddressProviderEvents.__parameters__
AddressProviderEvents.__wrapped__
AddressProviderEvents.addresses
AddressProviderEvents.bulk_insert
AddressProviderEvents.cache
AddressProviderEvents.executor
AddressProviderEvents.from_block
AddressProviderEvents.insert_to_db
AddressProviderEvents.is_asleep
AddressProviderEvents.is_reusable
AddressProviderEvents.materialized
AddressProviderEvents.provider
AddressProviderEvents.semaphore
AddressProviderEvents.to_block
AddressProviderEvents.topics
CurveEvents
CurveEvents.obj_type
CurveEvents.__aiter__()
CurveEvents.__await__()
CurveEvents.__del__()
CurveEvents.__init__()
CurveEvents.__iter__()
CurveEvents.__subclasshook__()
CurveEvents._objects_thru()
CurveEvents.events()
CurveEvents.filter()
CurveEvents.logs()
CurveEvents.objects()
CurveEvents.sort()
CurveEvents.wrap()
CurveEvents.__async_property__
CurveEvents.__orig_bases__
CurveEvents.__parameters__
CurveEvents.__wrapped__
CurveEvents.addresses
CurveEvents.bulk_insert
CurveEvents.cache
CurveEvents.executor
CurveEvents.from_block
CurveEvents.insert_to_db
CurveEvents.is_asleep
CurveEvents.is_reusable
CurveEvents.materialized
CurveEvents.semaphore
CurveEvents.to_block
CurveEvents.topics
CurvePool
CurvePool._decimals
CurvePool._scale
CurvePool.__eq__()
CurvePool.__init__()
CurvePool.__str__()
CurvePool.__build_name__
CurvePool.__coins__
CurvePool.__coins_decimals__
CurvePool.__decimals__
CurvePool.__factory__
CurvePool.__get_underlying_coins__
CurvePool.__name__
CurvePool.__num_coins__
CurvePool.__scale__
CurvePool.__symbol__
CurvePool.address
CurvePool.asynchronous
CurvePool.balance_of
CurvePool.balance_of_readable
CurvePool.build_name
CurvePool.check_liquidity
CurvePool.coins
CurvePool.coins_decimals
CurvePool.contract
CurvePool.decimals
CurvePool.deploy_block
CurvePool.factory
CurvePool.get_balances
CurvePool.get_coin_index
CurvePool.get_dy
CurvePool.get_tvl
CurvePool.get_underlying_coins
CurvePool.has_method
CurvePool.name
CurvePool.num_coins
CurvePool.price
CurvePool.scale
CurvePool.symbol
CurvePool.total_supply
CurvePool.total_supply_readable
CurveRegistry
CurveRegistry.__init__()
CurveRegistry.__coin_to_pools__
CurveRegistry.__registry__
CurveRegistry.check_liquidity
CurveRegistry.coin_to_pools
CurveRegistry.get_factory
CurveRegistry.get_pool
CurveRegistry.get_price
CurveRegistry.get_price_for_underlying
CurveRegistry.identifiers
CurveRegistry.load_all
CurveRegistry.registry
Factory
Ids
Ids.__abs__()
Ids.__add__()
Ids.__and__()
Ids.__bool__()
Ids.__ceil__()
Ids.__divmod__()
Ids.__eq__()
Ids.__float__()
Ids.__floor__()
Ids.__floordiv__()
Ids.__format__()
Ids.__ge__()
Ids.__getattribute__()
Ids.__getnewargs__()
Ids.__gt__()
Ids.__index__()
Ids.__int__()
Ids.__invert__()
Ids.__le__()
Ids.__lshift__()
Ids.__lt__()
Ids.__mod__()
Ids.__mul__()
Ids.__ne__()
Ids.__neg__()
Ids.__or__()
Ids.__pos__()
Ids.__pow__()
Ids.__radd__()
Ids.__rand__()
Ids.__rdivmod__()
Ids.__rfloordiv__()
Ids.__rlshift__()
Ids.__rmod__()
Ids.__rmul__()
Ids.__ror__()
Ids.__round__()
Ids.__rpow__()
Ids.__rrshift__()
Ids.__rshift__()
Ids.__rsub__()
Ids.__rtruediv__()
Ids.__rxor__()
Ids.__sizeof__()
Ids.__sub__()
Ids.__truediv__()
Ids.__trunc__()
Ids.__xor__()
Ids.as_integer_ratio()
Ids.bit_count()
Ids.bit_length()
Ids.conjugate()
Ids.from_bytes()
Ids.to_bytes()
Ids.CryptoPool_Factory
Ids.CryptoSwap_Registry
Ids.Cryptopool_Factory
Ids.CurveStableswapFactoryNG
Ids.Curve_Tricrypto_Factory
Ids.Exchanges
Ids.Fee_Distributor
Ids.Main_Registry
Ids.Metapool_Factory
Ids.PoolInfo_Getters
Ids.crvUSD_Plain_Pools
Ids.crvUSD_Plain_Pools_deprecated_1
Ids.crvUSD_Plain_Pools_deprecated_2
Ids.denominator
Ids.imag
Ids.numerator
Ids.real
Registry
RegistryEvents
RegistryEvents.obj_type
RegistryEvents.__aiter__()
RegistryEvents.__await__()
RegistryEvents.__del__()
RegistryEvents.__init__()
RegistryEvents.__iter__()
RegistryEvents.__subclasshook__()
RegistryEvents._objects_thru()
RegistryEvents.events()
RegistryEvents.filter()
RegistryEvents.logs()
RegistryEvents.objects()
RegistryEvents.sort()
RegistryEvents.wrap()
RegistryEvents.__async_property__
RegistryEvents.__orig_bases__
RegistryEvents.__parameters__
RegistryEvents.__wrapped__
RegistryEvents.addresses
RegistryEvents.bulk_insert
RegistryEvents.cache
RegistryEvents.executor
RegistryEvents.from_block
RegistryEvents.insert_to_db
RegistryEvents.is_asleep
RegistryEvents.is_reusable
RegistryEvents.materialized
RegistryEvents.registry
RegistryEvents.semaphore
RegistryEvents.to_block
RegistryEvents.topics
ADDRESS_PROVIDER
DED_POOLS
- y.prices.stable_swap.ellipsis module
- y.prices.stable_swap.froyo module
- y.prices.stable_swap.mstablefeederpool module
- y.prices.stable_swap.saddle module
- Module contents
- y.prices.tokenized_fund package
- Submodules
- y.prices.tokenized_fund.basketdao module
- y.prices.tokenized_fund.gelato module
- y.prices.tokenized_fund.piedao module
- y.prices.tokenized_fund.reserve module
- y.prices.tokenized_fund.tokensets module
TokenSet
TokenSet._decimals
TokenSet._scale
TokenSet.__eq__()
TokenSet.__init__()
TokenSet.__str__()
TokenSet.__build_name__
TokenSet.__decimals__
TokenSet.__name__
TokenSet.__scale__
TokenSet.__symbol__
TokenSet.address
TokenSet.asynchronous
TokenSet.balance_of
TokenSet.balance_of_readable
TokenSet.balances
TokenSet.build_name
TokenSet.components
TokenSet.contract
TokenSet.decimals
TokenSet.deploy_block
TokenSet.get_price
TokenSet.has_method
TokenSet.name
TokenSet.price
TokenSet.scale
TokenSet.symbol
TokenSet.total_supply
TokenSet.total_supply_readable
get_price
is_token_set
- Module contents
- y.prices.utils package
Submodules
y.prices.band module
- class y.prices.band.Band[source]
Bases:
ASyncGenericSingleton
- __contains__(asset)[source]
- Parameters:
asset (str | HexBytes | AnyAddress | EthAddress | Contract)
- Return type:
- __oracle__: HiddenMethodDescriptor[Self, Contract]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- get_price[source]
- Parameters:
asset (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber | None)
- Return type:
float | None
y.prices.chainlink module
- class y.prices.chainlink.Chainlink[source]
Bases:
ASyncGenericBase
- get_feed[source]
Since get_feed 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:
asset (str | HexBytes | AnyAddress | EthAddress)
- Return type:
Feed | None
- get_price[source]
- Parameters:
block (int | BlockNumber | None)
- Return type:
- has_feed[source]
- Parameters:
asset (str | HexBytes | AnyAddress | EthAddress | Contract | int)
- Return type:
- class y.prices.chainlink.Feed[source]
Bases:
object
- __init__(address, asset, start_block=0, asynchronous=False)[source]
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
asset (str | HexBytes | AnyAddress | EthAddress | Contract | int)
start_block (int)
asynchronous (bool)
- address
- asset
- latest_answer
- latest_timestamp
- start_block
- class y.prices.chainlink.FeedsFromEvents[source]
Bases:
ProcessedEvents
[Feed
]When awaited, a list of all elements will be returned.
- obj_type
alias of
_EventItem
- __aiter__()
Returns an async iterator for the wrapped async iterable.
- Return type:
- __await__()
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
- __del__()
- Return type:
None
- __init__(addresses, topics, asynchronous=True)[source]
Initializes the ASyncIterable with an async iterable.
- Parameters:
asynchronous (bool)
- classmethod __subclasshook__(C)
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- filter(function)
Filters the contents of the async iterable based on a function.
- Parameters:
function (Callable[[T], Awaitable[bool]] | Callable[[T], bool]) – A function that returns a boolean that indicates if an item should be included in the filtered result. Can be sync or async.
- Returns:
An instance of
ASyncFilter
that will yield the filtered objects yielded from this instance.- Return type:
ASyncFilter[T]
- logs(to_block)
- Parameters:
to_block (int | None)
- Return type:
ASyncIterator[LogReceipt]
- sort(*, key=None, reverse=False)
Sorts the contents of the {cls}.
- Parameters:
key (optional) – A function of one argument that is used to extract a comparison key from each list element. If None, the elements themselves will be sorted. Defaults to None.
reverse (optional) – If True, the yielded elements will be sorted in reverse order. Defaults to False.
- Returns:
An instance of
ASyncSorter
that will yield the objects yielded from this {cls}, but sorted.- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)
Class method to wrap an AsyncIterable for backward compatibility.
- Parameters:
wrapped (AsyncIterable[T])
- Return type:
- __async_property__
- __orig_bases__ = (y.utils.events.ProcessedEvents[y.prices.chainlink.Feed],)
- __parameters__ = ()
- __wrapped__: AsyncIterable[T]
The wrapped async iterable object.
- addresses
- asynchronous
- property cache: LogCache
- property executor: _AsyncExecutorMixin
- from_block
- is_reusable
- property materialized: List[T]
Iterates through all contents of
Self
and returns alist
containing the results.
- property semaphore: BlockSemaphore
- to_block
- topics
y.prices.convex module
- ASyncFunctiony.prices.convex.get_price(token_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]
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 (EthAddress)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- y.prices.convex.is_convex_lp(token_address)[source]
- Parameters:
token_address (EthAddress)
- Return type:
y.prices.gearbox module
- class y.prices.gearbox.DieselPool[source]
Bases:
ContractBase
- __eq__(_ContractBase__o)
Return self==value.
- __init__(address, asynchronous=False, _deploy_block=None)
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
asynchronous (bool)
_deploy_block (int | None)
- Return type:
None
- __build_name__: HiddenMethodDescriptor[Self, str]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __contract__: HiddenMethodDescriptor[Self, Contract]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __diesel_token__: HiddenMethodDescriptor[Self, ERC20]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __underlying__: HiddenMethodDescriptor[Self, ERC20]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- address
- build_name
- exchange_rate[source]
- Parameters:
block (int | BlockNumber)
- Return type:
- class y.prices.gearbox.Gearbox[source]
Bases:
ASyncGenericBase
- get_price[source]
- Parameters:
token (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber)
skip_cache (bool)
- Return type:
- is_diesel_token[source]
- Parameters:
token (str | HexBytes | AnyAddress | EthAddress)
- Return type:
- pools[source]
Since pools 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.- Return type:
y.prices.magic module
- ASyncFunctiony.prices.magic.get_price(token_address: AnyAddressType, block: Block | None = None, *, fail_to_None: Literal[True], skip_cache: bool = ENVS.SKIP_CACHE, ignore_pools: Tuple[Pool, ...] = (), silent: bool = False) UsdPrice | None [source]
- ASyncFunctiony.prices.magic.get_price(token_address: AnyAddressType, block: Block | None = None, *, fail_to_None: bool = False, skip_cache: bool = ENVS.SKIP_CACHE, ignore_pools: Tuple[Pool, ...] = (), silent: bool = False) UsdPrice
Don’t pass an int like 123 into token_address please, that’s just silly. - ypricemagic accepts ints to allow you to pass y.get_price(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e)
so you can save yourself some keystrokes while testing in a console
(as opposed to y.get_price(“0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e”))
When get_price is unable to find a price: - If silent == True, ypricemagic will print an error message using standard python logging - If silent == False, ypricemagic will not log any error - If fail_to_None == True, ypricemagic will return None - If fail_to_None == False, ypricemagic will raise a PriceError
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.
- ASyncFunctiony.prices.magic.get_prices(token_addresses: Iterable[AnyAddressType], block: Block | None = None, *, fail_to_None: Literal[True], skip_cache: bool = ENVS.SKIP_CACHE, silent: bool = False) List[UsdPrice | None] [source]
- ASyncFunctiony.prices.magic.get_prices(token_addresses: Iterable[AnyAddressType], block: Block | None = None, *, fail_to_None: bool = False, skip_cache: bool = ENVS.SKIP_CACHE, silent: bool = False) List[UsdPrice]
A more optimized way to fetch prices for multiple assets at the same block.
# NOTE silent kwarg is currently disabled. In every case: - if silent == True, tqdm will not be used - if silent == False, tqdm will be used
When get_prices is unable to find a price: - if fail_to_None == True, ypricemagic will return None for that token - if fail_to_None == False, ypricemagic will raise a yPriceMagicError
Since get_prices 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.
- y.prices.magic.map_prices(token_addresses: Iterable[str | HexBytes | AnyAddress | EthAddress | Contract | int], block: int | BlockNumber, *, fail_to_None: Literal[True], skip_cache: bool = ENVS.SKIP_CACHE, silent: bool = False) TaskMapping[str | HexBytes | AnyAddress | EthAddress | Contract | int, UsdPrice | None] [source]
- y.prices.magic.map_prices(token_addresses: Iterable[str | HexBytes | AnyAddress | EthAddress | Contract | int], block: int | BlockNumber, *, fail_to_None: bool = False, skip_cache: bool = ENVS.SKIP_CACHE, silent: bool = False) TaskMapping[str | HexBytes | AnyAddress | EthAddress | Contract | int, UsdPrice]
y.prices.one_to_one module
- ASyncFunctiony.prices.one_to_one.get_price(token_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]
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 (EthAddress)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- y.prices.one_to_one.is_one_to_one_token(token_address)[source]
- Parameters:
token_address (EthAddress)
- Return type:
y.prices.pendle module
- ASyncFunctiony.prices.pendle.get_lp_price(token: Union[str, hexbytes.main.HexBytes, ~AnyAddress, brownie.convert.datatypes.EthAddress], block: Union[int, eth_typing.evm.BlockNumber] = None, skip_cache: bool = <EnvironmentVariable[name=`YPRICEMAGIC_SKIP_CACHE`, type=bool, default_value=False, current_value=False, using_default=True]>) decimal.Decimal [source]
Since get_lp_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)
block (int | BlockNumber)
skip_cache (bool)
- Return type:
- y.prices.pendle.get_tokens(lp_token)[source]
- Parameters:
lp_token (str | HexBytes | AnyAddress | EthAddress)
- Return type:
- ASyncFunctiony.prices.pendle.is_pendle_lp(token: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress) bool [source]
Since is_pendle_lp 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)
- Return type:
y.prices.popsicle module
- ASyncFunctiony.prices.popsicle.get_balances(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]>, _async_balance_objects: bool = False) Tuple[y.classes.common.WeiBalance, y.classes.common.WeiBalance] | None [source]
Since get_balances 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)
_async_balance_objects (bool)
- Return type:
Tuple[WeiBalance, WeiBalance] | None
- ASyncFunctiony.prices.popsicle.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 | None [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:
UsdPrice | None
- ASyncFunctiony.prices.popsicle.get_tvl(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.UsdValue | None [source]
Since get_tvl 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:
UsdValue | None
- ASyncFunctiony.prices.popsicle.is_popsicle_lp(token_address: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool [source]
Since is_popsicle_lp 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.rkp3r module
- async y.prices.rkp3r.get_discount(block=None)[source]
- Parameters:
block (int | BlockNumber | None)
- Return type:
- ASyncFunctiony.prices.rkp3r.get_price(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]
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 (str | HexBytes | AnyAddress | EthAddress)
block (int | BlockNumber | None)
skip_cache (bool)
- Return type:
- y.prices.rkp3r.is_rkp3r(address)[source]
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress)
- Return type:
y.prices.solidex module
- ASyncFunctiony.prices.solidex.get_price(token: Union[str, hexbytes.main.HexBytes, ~AnyAddress, brownie.convert.datatypes.EthAddress, brownie.network.contract.Contract, int], block: Optional[int] = None, skip_cache: bool = <EnvironmentVariable[name=`YPRICEMAGIC_SKIP_CACHE`, type=bool, default_value=False, current_value=False, using_default=True]>)[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 | None)
skip_cache (bool)
- ASyncFunctiony.prices.solidex.is_solidex_deposit(token: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool [source]
Since is_solidex_deposit 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.synthetix module
- class y.prices.synthetix.Synthetix[source]
Bases:
ASyncGenericSingleton
- __address_resolver__: HiddenMethodDescriptor[Self, Contract]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- get_address[source]
- Get contract from Synthetix registry.
See also https://docs.synthetix.io/addresses/
Since get_address 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:
name (str)
block (int | BlockNumber)
- Return type:
- get_currency_key[source]
Since get_currency_key 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 (str | HexBytes | AnyAddress | EthAddress | Contract | int)
- Return type:
HexString | None
- get_price[source]
Get a price of a synth in dollars.
- Parameters:
token (str | HexBytes | AnyAddress | EthAddress | Contract | int)
block (int | BlockNumber | None)
- Return type:
UsdPrice | None
- is_synth[source]
returns True if a token is a synth, False if not
- Parameters:
token (str | HexBytes | AnyAddress | EthAddress | Contract | int)
- Return type:
- y.prices.synthetix.encode_bytes(s)
y.prices.yearn module
- class y.prices.yearn.YearnInspiredVault[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, _deploy_block=None)
- Parameters:
address (str | HexBytes | AnyAddress | EthAddress | Contract | int)
asynchronous (bool)
_deploy_block (int | None)
- Return type:
None
- __build_name__: HiddenMethodDescriptor[Self, str]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __decimals__: HiddenMethodDescriptor[Self, int]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __scale__: HiddenMethodDescriptor[Self, int]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __symbol__: HiddenMethodDescriptor[Self, str]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- __underlying__: HiddenMethodDescriptor[Self, ERC20]
- Parameters:
instance (I)
owner (Type[I] | None)
- Return type:
T
- 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:
- build_name
- decimals
- name
- price[source]
- Parameters:
block (int | BlockNumber | None)
ignore_pools (Tuple[UniswapV2Pool | CurvePool, ...])
skip_cache (bool)
- Return type:
- scale
- Parameters:
block (int | BlockNumber | None)
- Return type:
Decimal | None
- symbol
- total_supply
- Parameters:
block (int | BlockNumber | None)
- Return type:
- total_supply_readable
- Parameters:
block (int | BlockNumber | None)
- Return type:
- ASyncFunctiony.prices.yearn.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]>, ignore_pools: Tuple[Union[ForwardRef('UniswapV2Pool'), ForwardRef('CurvePool')], ...] = ()) 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)
ignore_pools (Tuple[UniswapV2Pool | CurvePool, ...])
- Return type:
- ASyncFunctiony.prices.yearn.is_yearn_vault(token: str | hexbytes.main.HexBytes | AnyAddress | brownie.convert.datatypes.EthAddress | brownie.network.contract.Contract | int) bool [source]
Since is_yearn_vault 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: