Get token price

Returns one DEX trade on Ethereum and BNB Chain, where base currency is 0x603c…9a95, quote currency is 0xbb4C…095c and base currency is 0xbb4C…095c, sorted by block height transaction index, highest first: block height, timestamp time, transaction index, base currency symbol, quote currency symbol and quote price.

By Raul · saved 8 August 2022 · run 88 times · Bitquery API v1

What it returns

Filters

The query

query ($network: EthereumNetwork!, $principalToken: String!, $mainToken: String!, $quoteCurrency: String!, $from: ISO8601DateTime, $to: ISO8601DateTime) {
  ethereum(network: $network) {
    dexTrades(
      baseCurrency: {is: $principalToken}
      quoteCurrency: {is: $mainToken}
      options: {desc: ["block.height", "transaction.index"], limit: 1}
      date: {since: $from, till: $to}
    ) {
      block {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      transaction {
        index
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
    }
    mainPrice: dexTrades(
      baseCurrency: {is: $mainToken}
      quoteCurrency: {is: $quoteCurrency}
      options: {desc: ["block.height", "transaction.index"], limit: 1}
      date: {since: $from, till: $to}
    ) {
      block {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      transaction {
        index
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
    }
  }
}

Variables

{
  "network": "bsc",
  "principalToken": "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95",
  "mainToken": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
  "quoteCurrency": "0xe9e7cea3dedca5984780bafc599bd69add087d56",
  "from": "2021-02-13T23:00:00.000Z",
  "to": "2021-04-02T01:00:00.000Z"
}

Similar queries