Trades by blocks and pair

Cake Currency Price using Cake-USDT Pair

Returns 100 DEX trades on Ethereum, where base currency is 0x1111…c302 and quote currency is 0xa0b8…eb48, sorted by block height transaction index, highest first: block height, timestamp time, transaction hash, transaction index, base currency symbol, quote currency symbol, quote price and 2 more fields.

By n.kozlov · saved 1 June 2021 · Bitquery API v1

What it returns

Filters

The query

query ($buyCurrency: String, $sellCurrency: String, $fromBlock: Int, $toBlock: Int) {
  ethereum(network: ethereum) {
    dexTrades(
      baseCurrency: {is: $buyCurrency}
      quoteCurrency: {is: $sellCurrency}
      height: {gteq: $fromBlock, lteq: $toBlock}
      options: {desc: ["block.height", "transaction.index"], limit: 100}
    ) {
      block {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      transaction {
        hash
        index
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
      baseAmount
      quoteAmount
    }
  }
}

Variables

{
  "fromBlock": 12548845,
  "toBlock": 12648846,
  "buyCurrency": "0x111111111117dc0aa78b770fa6a738034120c302",
  "sellCurrency": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}

Similar queries