Buys, Sells, BuyVolume, SellVolume, Makers, TotalTradedVolume, PriceinUSD

Returns DEX trades by token on Ethereum, where currency smart contract is 0x4206…2B39, DEX smart contract is 0x8422…a7f4 and block time since 2024-10-11: currency name, smart contract, currency symbol, price in USD, protocol name, protocol family, side currency symbol and 4 more fields.

By Akshat · saved 11 October 2024 · Bitquery API v2

What it returns

Filters

The query

query MyQuery {
  EVM(dataset: realtime, network: eth) {
    DEXTradeByTokens(
      where: {TransactionStatus: {Success: true}, Trade: {Currency: {SmartContract: {is: "0x42069026EAC8Eee0Fd9b5f7aDFa4f6E6D69a2B39"}}, Dex: {SmartContract: {is: "0x842293fa6ee0642bf61ebf8310e7e546039ba7f4"}}}, Block: {Time: {since: "2024-10-11T09:30:00Z"}}}
    ) {
      Trade {
        Currency {
          Name
          SmartContract
          Symbol
        }
        startPrice: PriceInUSD(minimum: Block_Time)
        Price_at_min5: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
        )
        current_price: PriceInUSD(maximum: Block_Time)
        Dex {
          ProtocolName
          ProtocolFamily
          SmartContract
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract
          }
        }
      }
      makers: count(distinct: Transaction_From)
      makers_5min: count(
        distinct: Transaction_From
        if: {Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      buyers: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      buyers_5min: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      sellers: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sellers_5min: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      trades: count
      trades_5min: count(if: {Block: {Time: {after: "2024-10-11T10:25:00Z"}}})
      traded_volume: sum(of: Trade_Side_AmountInUSD)
      traded_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      buy_volume: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      buy_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      sell_volume: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sell_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      buys: count(if: {Trade: {Side: {Type: {is: sell}}}})
      buys_5min: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
      sells: count(if: {Trade: {Side: {Type: {is: buy}}}})
      sells_5min: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: "2024-10-11T10:25:00Z"}}}
      )
    }
  }
}

Similar queries