Get USDT Price in USD Template

Convert the price of the USDT in USD. This API takes current price of USDT from different DEXes on Ethereum and converts that price to USD.

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

What it returns

Filters

The query

query($token: String){
  ethereum(network: ethereum) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: 1, offset: 0}
      buyCurrency: {is: $token}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      tradeIndex
      protocol
      exchange {
        fullName
      }
      buyAmount
      buyCurrency {
        symbol
      }
      buy_amount_usd: buyAmount(in: USD)
      sellAmount
      sellCurrency {
        symbol
      }
      sell_amount_usd: sellAmount(in: USD)
      priceInUSD: expression(get: "buy_amount_usd / buyAmount")
    }
  }
}

Variables

{
	"token": "0xdac17f958d2ee523a2206206994597c13d831ec7"
}

Similar queries