Look Up Token Prices
Use client.prices for Alchemy Prices API methods. These methods are global
and do not take a network selector.
Current Prices By Symbol
from alchemy import Alchemy
async with Alchemy.new() as client:
prices = await client.prices.by_symbol(symbols=['ETH', 'BTC'])
print(prices['data'])
Current Prices By Contract
from alchemy import Alchemy
async with Alchemy.new() as client:
prices = await client.prices.by_address({
'addresses': [
{
'network': 'eth-mainnet',
'address': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
}
],
})
print(prices['data'])