getTokenTrades

Returns the latest 1000 DEX trades by token on Base, where trade buyer is 0xb4d8…332c, currency smart contract is 0x8335…2913 or 0x50c5…B0Cb and trade seller is 0xb4d8…332c: block time, transaction hash, currency symbol, smart contract, decimals, currency name, delegated and 4 more fields.

By Jose · saved 30 October 2024 · run 13 times · Bitquery API v2

What it returns

Filters

The query

query getTokenTrades(
  $dataset: dataset_arg_enum!,
  $network: evm_network!,
  $limit: Int!,
  $offset: Int!,
  $tokenAddresses: [String!],
  $wallet: String!,
  $since: DateTime!,
  $till: DateTime!
) {
  EVM(dataset: $dataset, network: $network) {
    buyside: DEXTradeByTokens(
      limit: {count: $limit, offset: $offset}
      orderBy: {descending: Block_Time}
      where: {
        TransactionStatus: {Success: true}
        Trade: {Buyer: { is: $wallet }, Side: { Type: { is: sell }}, Currency: {SmartContract: {in: $tokenAddresses}}}
        Block: {Time: {since: $since, till: $till}}
      }
    ) {
      Block {
        Time
      }
      Transaction {
        Hash
      }
      Trade {
        Currency {
          Symbol
          SmartContract
          Decimals
          Name
        }
        Dex {
          Delegated
          DelegatedTo
        }
        Amount
        AmountInUSD
        PriceInUSD
      }
    }
    sellside: DEXTradeByTokens(
      limit: {count: $limit, offset: $offset}
      orderBy: {descending: Block_Time}
      where: {
        TransactionStatus: {Success: true}
        Trade: {Seller: { is: $wallet }, Side: { Type: { is: buy }}, Currency: {SmartContract: {in: $tokenAddresses}}}
        Block: {Time: {since: $since, till: $till}}
      }
    ) {
      Block {
        Time
      }
      Transaction {
        Hash
      }
      Trade {
        Currency {
          Symbol
          SmartContract
          Decimals
          Name
        }
        Dex {
          Delegated
          DelegatedTo
        }
        Amount
        AmountInUSD
        PriceInUSD
      }
    }
  }
}

Variables

{
  "dataset": "combined",
  "network": "base",
  "tokenAddresses": [
    "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb"
  ],
  "till": "2024-10-30T09:52:30.948Z",
  "since": "2024-05-03T09:52:30.948Z",
  "wallet": "0xb4d857f275da05982b0ffc7fac19f3fcdb1e332c",
  "limit": 1000,
  "offset": 0
}

Similar queries