getTokenTrades

Returns the latest 100 DEX trades on Ethereum, where buy currency smart contract is 0x5283…8b44, buy seller is 0x1111…0582 and sell currency smart contract is 0x5283…8b44: block time, buy amount, buy currency symbol, buy price, buy amount in USD, buy price in USD, amount in USD and 7 more fields.

By Jose · saved 14 September 2024 · run 25 times · Bitquery API v2

What it returns

Filters

The query

query getTokenTrades($dataset: dataset_arg_enum!, $network: evm_network!, $limit: Int!, $tokenAddress: String!, $wallet: String!, $since: DateTime!, $till: DateTime!) {
  EVM(dataset: $dataset, network: $network) {
    buyside: DEXTrades(
      limit: {count: $limit}
      orderBy: {descending: Block_Time}
      where: {Trade: {Buy: {Currency: {SmartContract: {is: $tokenAddress}}, Seller: {is: $wallet}}}, Block: {Time: {since: $since, till: $till}}}
    ) {
      Block {
        Time
      }
      Trade {
        Buy {
          Amount
          Currency {
            Symbol
          }
          Price
          AmountInUSD
          PriceInUSD
        }
        Fees {
          AmountInUSD
          Amount
        }
        PriceAsymmetry
      }
    }
    sellside: DEXTrades(
      limit: {count: $limit}
      orderBy: {descending: Block_Time}
      where: {Trade: {Sell: {Currency: {SmartContract: {is: $tokenAddress}}, Buyer: {is: $wallet}}}, Block: {Time: {since: $since, till: $till}}}
    ) {
      Block {
        Time
      }
      Trade {
        Sell {
          Amount
          Currency {
            Symbol
          }
          Price
          AmountInUSD
          PriceInUSD
        }
        Fees {
          AmountInUSD
          Amount
        }
        PriceAsymmetry
      }
    }
  }
}

Variables

{
  "dataset": "archive",
  "network": "eth",
  "limit": 100,
  "tokenAddress": "0x5283d291dbcf85356a21ba090e6db59121208b44",
  "wallet": "0x1111111254eeb25477b68fb85ed929f73a960582",
  "since": "2023-03-03T01:00:00Z",
  "till": "2023-03-05T05:15:23Z"
}

Similar queries