Example of DEX candlestick pair query by all exchanges / protocols

Returns DEX trades on Ethereum, where base currency is 0x1111…c302, quote currency is 0xa0b8…eb48 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 Aleksey · saved 25 January 2021 · run 18 times · Bitquery API v1

What it returns

Filters

The query

query ($baseAddress: String, $quoteAddress: String, $from: ISO8601DateTime!, $to: ISO8601DateTime!, $interval: Int) {
  ethereum(network: ethereum) {
    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": "2020-12-25T21:52:30+03:00",
  "to": "2021-01-25T12:53:30+03:00",
  "interval": 30,
  "baseAddress": "0x111111111117dc0aa78b770fa6a738034120c302",
  "quoteAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}

Similar queries