Added filters OHLC

Returns DEX trades by token on Polygon, where currency smart contract is 0x7ceb…f619, trade amount in USD is above 0 and side amount in USD is above 0, sorted by block time: block time, quantile of trade price in USD, average of trade price in USD, sum of trade side amount and count.

By Aleksey · saved 27 September 2024 · Bitquery API v2

What it returns

Filters

The query

query tradingView($network: evm_network, $token: String) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {Trade: {
        AmountInUSD: {gt: "0"}
        Side: {
          AmountInUSD: {gt: "0"}
        }
        Currency: {SmartContract: {is: $token}}}}
    ) {
      Block {
        Time(interval: {count: 5, in: minutes})
      }
      min: quantile(of: Trade_PriceInUSD, level: 0.1)
      max: quantile(of: Trade_PriceInUSD, level: 0.9)
      close: average(of: Trade_PriceInUSD)
      open: average(of: Trade_PriceInUSD)
      volume: sum(of: Trade_Side_Amount)
      count
    }
  }
}

Variables

{
  "network": "matic",
  "token": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"
}

Similar queries