Returns real-time or historical prices for a list of tokens.
Endpoint: getTokenPrices
Method: POST
Price Calculation
Prices are calculated by routing along the highest liquidity path to a known pair of stablecoins, and handles the case if a stablecoin ever depegs from 1 USD.
Arguments
Name | Type | Description |
---|---|---|
inputs | [GetPriceInput] | A list of |
Response
Examples
Current Prices Query
Use this query to find current prices for multiple tokens.
{
getTokenPrices(
inputs: [
{ address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", networkId: 1 }
{ address: "0x4d224452801aced8b2f0aebe155379bb5d594381", networkId: 1 }
]
) {
address
networkId
priceUsd
}
}
Historical Price Query
Use this query to find historical prices for a token over a 3 day period.
{
getTokenPrices(
inputs: [
{
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
networkId: 1
timestamp: 1694198174
}
{
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
networkId: 1
timestamp: 1694111774
}
{
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
networkId: 1
timestamp: 1694025374
}
]
) {
priceUsd
}
}
Explore
Ask questions, share what you're working on and request new features 👬👭