Example of DEX candlestick pair query by all exchanges / protocols

Returns DEX trades on Ethereum and BNB Chain, where base currency is 0xc75a…521a, quote currency is 0xbb4C…095c and price asymmetry is below 0.7: minute, base currency symbol, base currency address, token ID, base amount, quote currency symbol, quote currency address and 5 more fields.

By brianchang · saved 24 November 2022 · run 27 times · Bitquery API v1

What it returns

Filters

The query

query ($baseAddress: String, $quoteAddress: String, $from: ISO8601DateTime!, $to: ISO8601DateTime!, $interval: Int) {
  ethereum(network: bsc) {
    dexTrades(
      baseCurrency: {is: $baseAddress}
      quoteCurrency: {is: $quoteAddress}
      date: {between: [$from, $to]}
      priceAsymmetry: {lt: 0.7}
      any: [{tradeAmountUsd: {gt: 0.00001}}, {tradeAmountUsd: {is: 0}}]
    ) {
      timeInterval {
        minute(format: "%FT%TZ", count: $interval)
      }
      buyCurrency: baseCurrency {
        symbol
        address
        tokenId
      }
      buyAmount: baseAmount
      sellCurrency: quoteCurrency {
        symbol
        address
      }
      volume: quoteAmount
      trades: count
      high: quotePrice(calculate: maximum)
      low: quotePrice(calculate: minimum)
      open: minimum(of: block, get: quote_price)
      close: maximum(of: block, get: quote_price)
    }
  }
}

Variables

{
  "from": "2022-11-29T21:52:30+03:00",
  "to": "2022-12-01T12:53:30+03:00",
  "interval": 30,
  "baseAddress": "0xc75aa1fa199eac5adabc832ea4522cff6dfd521a",
  "quoteAddress": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
}

Similar queries