query failed

Returns the latest 10 DEX trades by token on Ethereum, where side currency smart contract is 0xC02a…6Cc2, DEX smart contract is 0xA43f…Ec9f and side amount is above 0: block time, sum of trade side amount in USD, price in USD, trade price and count.

By gaurav · saved 23 December 2024 · run 5 times · Bitquery API v2

What it returns

Filters

The query

query EVMTokenPrice($pairAddress: String!, $timeInterval: OLAP_DateTimeIntervalUnits!, $intervalCount: Int!, $limit: Int!, $after: DateTime, $before: DateTime) {
  EVM(network: eth, dataset: combined) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "Block_timestamp"}
      where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"}}}, Dex: {SmartContract: {is: $pairAddress}}}, Block: {Time: {after: $after, before: $before}}}
      limit: {count: $limit}
    ) {
      Block {
        timestamp: Time(interval: {in: $timeInterval, count: $intervalCount})
      }
      volume: sum(of: Trade_Side_AmountInUSD)
      Trade {
        high: PriceInUSD(maximum: Trade_PriceInUSD)
        low: PriceInUSD(minimum: Trade_PriceInUSD)
        open: PriceInUSD(minimum: Block_Number)
        close: PriceInUSD(maximum: Block_Number)
        closeEth: Price(maximum: Block_Number)
      }
      count
    }
  }
}

Variables

{
  "pairAddress": "0xA43fe16908251ee70EF74718545e4FE6C5cCEc9f",
  "timeInterval": "minutes",
  "intervalCount": 10,
  "limit": 10
}

Similar queries