Token Price in USDT Template

This API provides the latest USDT token price in USD for Ethereum blockchain using DEXs like Uniswap, Balancer. You can also get the price of USDT Token at any previous date or time. You can also specify a specific exchange to get the price from using the filter.

By Nikhil · saved 7 July 2023 · run 7 times · Bitquery API v1

What it returns

Filters

The query

query get_token_price_in_usd($token: String) {
  ethereum(network: ethereum) {
    dexTrades(
      baseCurrency: {is: $token}
      quoteCurrency: {is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}
      options: {desc: ["block.height"], limit: 1}
    ) {
      block {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
      quoteAmountInUSD: quoteAmount(in: USD)
      baseAmount
      quotePriceInUSD: expression(get: "quoteAmountInUSD / baseAmount")
    }
  }
}

Variables

{
  "token":"0xdac17f958d2ee523a2206206994597c13d831ec7"
}

Similar queries