Latest_price_between_time_frame

Returns the latest DEX trade on Ethereum, where quote currency is 0xc02a…6cc2, base currency is 0xbe04…5bd6 and time since 2023-08-30: quote price, expression, block height, iso8601, trade index, address address, base amount and 5 more fields.

By Omkar Acharekar · saved 31 August 2023 · Bitquery API v1

What it returns

Filters

The query

query ($network: EthereumNetwork!, $from: ISO8601DateTime, $to: ISO8601DateTime) {
  ethereum(network: $network) {
    dexTrades(
      options: {desc: ["block.height", "tradeIndex"], limit: 1}
      quoteCurrency: {is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}
      baseCurrency: {is: "0xbe042e9d09CB588331Ff911c2B46FD833A3E5bd6"}
      time: {since: $from, till: $to}
    ) {
      quotePrice
      USDPrice: expression(get: "quoteAmountUSD / baseAmount")
      block {
        height
        timestamp {
          iso8601
        }
      }
      tradeIndex
      smartContract {
        address {
          address
        }
      }
      baseAmountUSD: baseAmount(in: USD)
      baseAmount
      baseCurrency {
        address
        symbol
      }
      quoteAmountUSD: quoteAmount(in: USD)
      quoteAmount
      quoteCurrency {
        address
        symbol
      }
    }
  }
}

Variables

{
  
  "network": "ethereum",
  "from": "2023-08-30T01:00:00Z",
  "to": "2023-08-30T01:01:00Z"
}

Similar queries