recent trades for a pair

Returns the latest 50 DEX trades by token on Ethereum, where side currency smart contract is 0xa0b8…eb48, currency smart contract is 0xc02a…6cc2 and side amount is above 0: block time, owner address, protocol family, protocol name, currency symbol, smart contract, currency name and 9 more fields.

By Akshat · saved 20 September 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query LatestTrades($network: evm_network, $token: String, $base: String) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descending: Block_Time}
      limit: {count: 50}
      where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}, Currency: {SmartContract: {is: $token}}, Price: {gt: 0}}}
    ) {
      Block {
        allTime: Time
      }
      Trade {
        Dex {
          OwnerAddress
          ProtocolFamily
          ProtocolName
        }
        Currency {
          Symbol
          SmartContract
          Name
        }
        Price
        AmountInUSD
        Amount
        Side {
          Type
          Currency {
            Symbol
            SmartContract
            Name
          }
          AmountInUSD
          Amount
        }
      }
    }
  }
}

Variables

{
  "network": "eth",
  "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "base": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}

Similar queries