Token Prices v1 API
Retrieve realtime and historical token prices on the Klaytn Mainnet, expressed in different fiat currencies, using the Prices API.
Change since v0
- Added the
timestamp
parameter for obtaining historical prices. Rate limiting applies to this endpoint if thetimestamp
parameter is specified. - Introduced the
market
parameter for defining the market currency. The new default isusd
(usd_coingecko
), formerlyousdc
inv0
.
How do we "price" tokens?
Unlike other APIs or oracles that rely on a single DEX's token reserve ratios, we consider the liquidity state of all DEXs integrated with Swapscanner. This approach enables us to calculate a fair and precise mid-price for every token.
Supported Market currencies
usd_coingecko
- Uses the USD price of KLAY on CoinGecko.usd
- Equivalent tousd_coingecko
.ousdc
- Assumes the oUSDC Token price as $1.krw_bithumb
- Adopts the KRW price of KLAY on Bithumb.krw
- Same askrw_bithumb
.krw_coingecko
- Takes the KRW price of KLAY on CoinGecko.krw_ousdc
- Uses theousdc
value but in KRW (CoinGecko's KRW/USD forex rate is applied).
Endpoint
https://api.swapscanner.io/v1/tokens/prices
Query Parameters
timestamp
- The Unix timestamp in milliseconds. Omittance returns the latest price. An error will occur if the timestamp is excessively outdated.market
- Defines the market currency, which defaults tousd
(usd_coingecko
). Refer to the Supported Market Currencies section for more options.
💡
- Due to the data's 15-minute granularity, historical prices may not be completely accurate.
💡
- If the
timestamp
parameter is included, a rate limit of 20 points per 5 seconds is imposed on this endpoint.
Response
The response is a JSON object with key-values represented as follows:
key
- Token addressvalue
-number
Represents the token price in the market currency.
Keys are sorted lexicographically.
Example
{
"0x0000000000000000000000000000000000000000": 0.19715361394261466,
"0x8888888888885b073f3c81258c27e83db228d5f3": 1.553748690198703,
...
}