Token Price in USDT Template

Any Token Price in USDT.

Returns the latest DEX trade on Ethereum, where base currency is 0xdac1…1ec7, quote currency is 0xc02a…6cc2 and date after 2023-07-01: block height, timestamp time, base amount, base currency symbol, quote amount, quote currency symbol, quote price and expression.

By gaurav · saved 7 July 2023 · run 1 time · Bitquery API v1

What it returns

Filters

The query

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

Variables

{
  "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "date": "2023-07-01"
}

Similar queries