Get Price

Get Price

https://datalayer.decommas.net/priceservice/get_price

Returns prices in ETH & in USD for requested ERC20 tokens in corresponding chain and DEX at last write block height. ETH price represented in 1e18 base, USD price represented as a floating point number.. If in pairs list: $TOKEN/USDC, $TOKEN/USDT, $TOKEN/DAI, $TOKEN/WETH each pair has liquidity less than 1 ETH, this token price will be not presented.

Supported Networks:

Supported Networks / DEXes:

  • Mainnet
    • UniswapV2
    • UniswapV3
    • SushiSwap
  • Polygon
    • UniswapV3
    • SushiSwap

If dex request field was not set - it produces aggregated requested tokens price across all supported DEXes on the regarding chain.

Note: If pool ETH reserves are less than 1 ETH, the token price will not be returned.

Notetokens length must be in range 1..=35 tokens in a list.

Request JSON body fields:

{
      // EVM chain name. See attachment 1 for supported chains.
      "chain": string,
      // Dex kind. Optional. See attachment 2 for supported kinds.
      "dex": string | null,
      // ERC-20 tokens addresses
      "tokens": string[]
}
  • Example:
curl -i -X 'POST' 'https://datalayer.decommas.net/priceservice/get_price' \
    -H 'accept: application/json' \
    -H 'x-decommas-key: {DECOMMAS_API_KEY}' \
    -H 'Content-Type: application/json' \
    -d '{
            "chain": "mainnet",
            "dex": "UniswapV2",
            "tokens": [
                "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "0xCaeda9650cCD356aF7776057a105F9e6FfE68213"
            ]
    }'
  • Response:
200 OK
content-type: application/json
{
  "chain": "mainnet",
  "dex": "UniswapV2",
  "block_height":18163775,
  "native_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "prices":[
    {
      "token_address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "price_in_eth":1000000000000000000,
      "price_in_usd":"1659.519411764706148352"
    },
    {
      "token_address":"0xcaeda9650ccd356af7776057a105f9e6ffe68213",
      "price_in_eth":9364053,
      "price_in_usd":"0.000000015539827726"
    }
  ]
}