quoteprice_in_usd_

Returns the latest DEX trade on Ethereum, where base currency is 0xc02a…6cc2, quote currency is 0xfcf8…bc0a and exchange name is Uniswap or Uniswap v2: timestamp time, block height, quote currency address, quote currency name, quote currency symbol, quote price, base currency address and 5 more fields.

By Omkar Acharekar · saved 7 June 2023 · run 6 times · Bitquery API v1

What it returns

Filters

The query

query ($date: ISO8601DateTime!, $tokenIn: String, $tokenOut: String) {
  ethereum(network: ethereum) {
    dexTrades(
      date: {is: $date}
      exchangeName: {in: ["Uniswap", "Uniswap v2"]}
      baseCurrency: {is: $tokenIn}
      quoteCurrency: {is: $tokenOut}
      options: {limit: 1, desc: "block.height"}
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      quoteCurrency {
        address
        name
        symbol
      }
      quotePrice
      baseCurrency {
        address
        name
        symbol
      }
      baseAmountinUSD: baseAmount(in: USD)
      quoteAmountinUSD: quoteAmount(in: USD)
      quotePriceinUSD: expression(get: "quoteAmountinUSD/baseAmountinUSD")
    }
  }
}

Variables

{
  "date": "2023-06-07",
  "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "tokenOut": "0xfcf8eda095e37a41e002e266daad7efc1579bc0a"
  
}

Similar queries