getPrice
getPrice method is used to fetch the latest price for a single or multiple tokens
Get the latest price for a single token
▸ getPrice(symbol
: string, opts?
: GetPriceOptions): _Promise<_PriceData>
Returns the latest price for a single symbol
Parameters:
Name | Type | Description |
| string | Token symbol (string) |
| GetPriceOptions | Optional params (object)
|
Returns: Promise<PriceData>
The latest price for the token
Get the latest price for multiple tokens
▸ getPrice(symbols
: string[], opts?
: GetPriceOptions): Promise<{ [token: string]: PriceData; }>
Returns the latest price for several symbols
Parameters:
Name | Type | Description |
| string[] | Token symbols (array of strings) |
| GetPriceOptions | Optional params (object)
|
Returns: Promise<{ [token: string]: PriceData; }>
The latest price for the tokens
Examples
Get the latest price for a single token
All the prices are denominated in USD. You can fetch price data for BTC, ETH, AR, EUR and any other of 100+ supported tokens
Price data format
Fetch price using promises
Get the latest prices for multiple tokens
To fetch prices for multiple tokens use the getPrice
method and pass an array with a subset of supported tokens.
Last updated