Copy of Example of query multiple pairs

Example shows how you can query multiple pairs ( markets ) in one query

Returns 500 DEX trades on Ethereum and BNB Chain, where exchange name is Pancake or Pancake v2, date since 2021-04-01 and date till 2023-01-28, sorted by time interval minute, highest first: minute, base currency symbol, base currency address, base amount, quote currency symbol, quote currency address, quote amount and 5 more fields.

By linthertoss · saved 27 January 2023 · run 3 times · Bitquery API v1

What it returns

Filters

The query

query ($baseAddress: String!, $quoteAddress: String!, $connector1: String!, $from: ISO8601DateTime!, $interval: Int) {
  ethereum(network: bsc) {
    dexTrades(
      any: [
        {baseCurrency: {is: $baseAddress}, quoteCurrency: {is: $connector1}}, 
        {baseCurrency: {is: $connector1}, quoteCurrency: {is: $quoteAddress}}
      ]
      exchangeName: {in: ["Pancake", "Pancake v2"]}
      date: {since: $from, till: "2023-01-28"}
      tradeAmountUsd: {gt: 10}
      options: {limit: 500, desc: "timeInterval.minute", offset: 1000}
    ) {
      timeInterval {
        minute(format: "%FT%TZ", count: $interval)
      }
      buyCurrency: baseCurrency {
        symbol
        address
      }
      buyAmount: baseAmount
      buyAmountInUsd: baseAmount(in: USD)
      sellCurrency: quoteCurrency {
        symbol
        address
      }
      sellAmountInUsd: quoteAmount(in: USD)
      tradeAmount(in: USD)
      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": "2021-04-01",
  "interval": 30,
  "baseAddress": "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
  "quoteAddress": "0xe9e7cea3dedca5984780bafc599bd69add087d56",
  "connector1": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "minAmount": 1000
}

Similar queries