Copy of New Query

Streams the latest 50 DEX trades by token and miner rewards on Optimism as they happen, where currency smart contract is 0x4200…0006, side currency smart contract is 0x0b2c…ff85, 0x94b0…8e58 or 2 more and block time since 2025-01-18: quantile of trade price in USD, block time, transaction hash, smart contract, protocol family, protocol name, amount in USD and 12 more fields.

By donalds · saved 17 February 2025 · Bitquery API v2

What it returns

Filters

The subscription

subscription LatestTrades($network: evm_network, $token: String, $usdc: String!, $usdt: String!, $weth: String!, $usdc2: String!, $time_ago: DateTime) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descending: Block_Time}
      limit: {count: 50}
      where: {TransactionStatus: {Success: true}, Trade: {Currency: {SmartContract: {is: $token}}, Price: {gt: 0}, Side: {Currency: {SmartContract: {in: [$usdc, $usdt, $weth, $usdc2]}}}}, Block: {Time: {since: $time_ago}}}
    ) {
      min: quantile(of: Trade_PriceInUSD, level: 0.05)
      max: quantile(of: Trade_PriceInUSD, level: 0.95)
      Block {
        Time
      }
      Transaction {
        Hash
      }
      Trade {
        Dex {
          SmartContract
          ProtocolFamily
          ProtocolName
        }
        AmountInUSD
        Buyer
        Seller
        Side {
          Type
          Buyer
          Seller
        }
        PriceInUSD
        close: PriceInUSD
        Amount
        Side {
          Currency {
            Symbol
            SmartContract
            Name
          }
          AmountInUSD
          Amount
        }
      }
    }
    MinerRewards
    Events
  }
}

Variables

{
  "network": "optimism",
  "token": "0x4200000000000000000000000000000000000006",
  "usdc": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
  "usdc2": "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
  "usdt": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
  "weth": "0x4200000000000000000000000000000000000006",
  "dataset": "combined",
  "time_ago": "2025-01-18T10:00:24Z",
  "interval": 5
}

Similar queries