Docs
Version 1 (v1)
Token Prices

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 the timestamp parameter is specified.
  • Introduced the market parameter for defining the market currency. The new default is usd (usd_coingecko), formerly ousdc in v0.

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 to usd_coingecko.
  • ousdc - Assumes the oUSDC Token price as $1.
  • krw_bithumb - Adopts the KRW price of KLAY on Bithumb.
  • krw - Same as krw_bithumb.
  • krw_coingecko - Takes the KRW price of KLAY on CoinGecko.
  • krw_ousdc - Uses the ousdc 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 to usd (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 address
  • value - number Represents the token price in the market currency.

Keys are sorted lexicographically.

Example

{
  "0x0000000000000000000000000000000000000000": 0.19715361394261466,
  "0x8888888888885b073f3c81258c27e83db228d5f3": 1.553748690198703,
  ...
}