Get USDT Price in USD

Returns the latest DEX trade on Ethereum, where buy currency is 0xdac1…1ec7: timestamp time, block height, trade index, protocol, full name, buy amount, buy currency symbol and 3 more fields.

By Nikhil · saved 6 July 2023 · run 3 times · Bitquery API v1

What it returns

Filters

The query

query($network: EthereumNetwork, $limit: Int, $offset: Int, $token_address: String){
  ethereum(network: $network) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: $limit, offset: $offset}
      buyCurrency: {is: $token_address}
    ) {
      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

{
  "limit": 1,
  "offset": 0,
  "network": "ethereum",
	"token_address": "0xdac17f958d2ee523a2206206994597c13d831ec7"
}

Similar queries