rt-s-shaheem

Streams DEX trades by token on Ethereum as they happen, where currency smart contract is 0x2856…Bcad, side currency smart contract is 0xC02a…6Cc2 and DEX smart contract is 0x470D…A03D: block time, trade amount, amount in USD, buyer, decimals, currency name, protocol name and 14 more fields.

By Hamza · saved 26 December 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The subscription

subscription ($network: evm_network, $quoteToken: String, $baseToken: String, $pairAddress: String) {
  EVM(network: $network) {
    DEXTradeByTokens(
      where: {Trade: {Currency: {SmartContract: {is: $baseToken}}, Side: {Currency: {SmartContract: {is: $quoteToken}}}, Dex: {SmartContract: {is: $pairAddress}}}}
    ) {
      Block {
        Time
      }
      Trade {
        Amount
        AmountInUSD
        Buyer
        Currency {
          Decimals
          Name
          ProtocolName
          Symbol
        }
        Dex {
          ProtocolName
          SmartContract
        }
        PriceInUSD
        Sender
        Side {
          Amount
          AmountInUSD
          Buyer
          Seller
          Currency {
            Decimals
            Name
            ProtocolName
            Symbol
          }
        }
      }
      Transaction {
        From
        Hash
      }
    }
  }
}

Variables

{
  "network": "eth",
  "quoteToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "baseToken": "0x28561B8A2360F463011c16b6Cc0B0cbEF8dbBcad",
  "pairAddress": "0x470DC172d6502Ac930B59322EcE5345dd456A03D"
}

Similar queries