missing date ranges issue

Returns one DEX trade on Ethereum and BNB Chain, where smart contract address is 0x60c9…dcf5, time since 2021-09-01 and time since 2021-08-01, sorted by time interval time: hour, base currency symbol, base currency address, quote currency symbol, quote currency address, quote price, minimum of block and 2 more fields.

By Mahmut Yaman · saved 4 December 2021 · Bitquery API v1

What it returns

Filters

The query

query ($currency1: String!, $currency2: String!, $pair: String!, $network: EthereumNetwork!) {
  ethereum(network: $network) {
    missingData: dexTrades(
      options: {asc: "timeInterval.time", limit: 1}
      time: {since: "2021-09-01T00:00:00.00Z"}
      smartContractAddress: {is: $pair}
      any: [{baseCurrency: {is: $currency1}, quoteCurrency: {is: $currency2}}]
    ) {
      timeInterval {
        time: hour(count: 4, format: "%FT%TZ")
      }
      baseCurrency {
        symbol
        address
      }
      quoteCurrency {
        symbol
        address
      }
      median: quotePrice(calculate: median)
      high: quotePrice(calculate: maximum)
      low: quotePrice(calculate: minimum)
      open: minimum(of: block, get: quote_price)
      close: maximum(of: block, get: quote_price)
      volume: quoteAmount(calculate: sum, in: USD)
    }
    oldData: dexTrades(
      options: {asc: "timeInterval.time", limit: 1}
      time: {since: "2021-08-01T00:00:00.00Z"}
      smartContractAddress: {is: $pair}
      any: [{baseCurrency: {is: $currency1}, quoteCurrency: {is: $currency2}}]
    ) {
      timeInterval {
        time: hour(count: 4, format: "%FT%TZ")
      }
      baseCurrency {
        symbol
        address
      }
      quoteCurrency {
        symbol
        address
      }
      median: quotePrice(calculate: median)
      high: quotePrice(calculate: maximum)
      low: quotePrice(calculate: minimum)
      open: minimum(of: block, get: quote_price)
      close: maximum(of: block, get: quote_price)
      volume: quoteAmount(calculate: sum, in: USD)
    }
  }
}

Variables

{
  "currency1": "0x293c3ee9abacb08bb8ced107987f00efd1539288",
  "currency2": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "pair": "0x60c9bd6eee0a911b987a749f0db0f24d79bcdcf5",
  "limit": 1,
  "network": "bsc"
}

Similar queries