Price per block

See the price per block, before, during and after the block

Returns one DEX trade on Ethereum and BNB Chain, where buy currency is 0x603c…9a95, sell currency is 0xbb4c…095c and base currency is 0xbb4c…095c, sorted by block height: price, block height, timestamp time and quote price.

By Raul · saved 1 June 2022 · run 3 times · Bitquery API v1

What it returns

Filters

The query

query prices($lower: Int!, $upper: Int!) {
  ethereum(network: bsc) {
    during: dexTrades(
      options: {asc: "block.height"}
      buyCurrency: {is: "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95"}
      sellCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
    ) {
      price
      block(height: {between: [$lower, $upper]}) {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
    }
    before: dexTrades(
      options: {limit: 1, desc: "block.height"}
      buyCurrency: {is: "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95"}
      sellCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
    ) {
      price
      block(height: {lt: $lower}) {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
    }
    after: dexTrades(
      options: {limit: 1, asc: "block.height"}
      buyCurrency: {is: "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95"}
      sellCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
    ) {
      price
      block(height: {gt: $upper}) {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
    }
    bnb_price: dexTrades(
      options: {limit: 1, asc: "block.height"}
      baseCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
      quoteCurrency: {is: "0xe9e7cea3dedca5984780bafc599bd69add087d56"}
    ) {
      block(height: {between: [$lower, $upper]}) {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      quotePrice
    }
  }
}

Similar queries