getTokenPriceForDate

Returns the latest 10 DEX trades by token on Base, where currency smart contract is 0x4200…0006, block time since 2024-10-14 and block time till 2024-10-15: trade amount, amount in USD and average of trade price in USD.

By Jose · saved 16 October 2024 · run 5 times · Bitquery API v2

What it returns

Filters

The query

query getTokenPriceForDate(
  $dataset: dataset_arg_enum!,
  $network: evm_network!,
  $tokenAddress: String!,
  $since: DateTime!,
  $till: DateTime!
) {
  EVM(dataset: $dataset, network: $network) {
    DEXTradeByTokens(
      # Get the last 10 trades
      limit: { count: 10 }
      orderBy: { descending: Block_Time }
      where: {Trade: {PriceInUSD: { gt: 0 }, Currency: {SmartContract: {is: $tokenAddress}}, AmountInUSD: {gt: "0.001"}}, Block: {Time: {since: $since, till: $till}}}
    ) {
      Trade {
        Amount
        AmountInUSD
      }
      PriceInUSD: average(of: Trade_PriceInUSD)
    }
  }
}

Variables

{
    "dataset": "combined",
    "network": "base",
    "limit": 10,
    "wallet": "0x5dC76A02C49d6f15FBdE0506e0d7cc630CEe5db2",
  	"tokenAddress": "0x4200000000000000000000000000000000000006",
    "since": "2024-10-14T00:00:00Z",
    "till": "2024-10-15T23:59:59Z"
  }

Similar queries