correct_query_to_sort_by_expression

Returns 50 DEX trades on Ethereum and BNB Chain, where quote currency is 0xe9e7…7d56, date since 2022-12-27 and date till 2022-12-27, sorted by ratio: minimum of block, maximum of block, expression, base currency address, base currency symbol, trade amount, full name and day.

By Andrey · saved 27 December 2022 · run 4 times · Bitquery API v1

What it returns

Filters

The query

query ($network: EthereumNetwork!, $limit: Int!, $stables: [String!], $since: ISO8601DateTime!, $till: ISO8601DateTime!) {
  ethereum(network: $network) {
    dexTrades(
      options: {asc: "ratio", limit: $limit, limitBy: {each: "baseCurrency.address", limit: 1}}
      quoteCurrency: {in: $stables}
      tradeAmountUsd: {gt: 1000}
      date: {since: $since, till: $till}
    ) {
      openPrice: minimum(of: block, get: quote_price)
      closePrice: maximum(of: block, get: quote_price)
      ratio: expression(get: "closePrice / openPrice")
      baseCurrency {
        address
        symbol
      }
      tradeAmount(in: USD)
      exchange {
        fullName
      }
      timeInterval {
        day(count: 1)
      }
    }
  }
}

Variables

{
  "network": "bsc",
  "limit": 50,
  "stables": [
    "0xe9e7cea3dedca5984780bafc599bd69add087d56"
  ],
  "since": "2022-12-27",
  "till": "2022-12-27"
}

Similar queries