latest traded currency - 1 latest trade per currency

Returns 1000 DEX trades on Ethereum, where time after 2023-05-17 and time before 2023-05-17, sorted by block height trade index: block height, iso8601, transaction hash, trade index, buy currency symbol, buy currency address, buy currency name and 13 more fields.

By gaurav · saved 14 August 2023 · Bitquery API v1

What it returns

Filters

The query

query ($from: ISO8601DateTime!, $to: ISO8601DateTime!) {
  ethereum(network: ethereum) {
    dexTrades(
      time: {after: $from, before: $to}
      options: {limit: 1000, asc: ["block.height", "tradeIndex"], limitBy: {each: "buyCurrency.address, sellCurrency.address", limit: 1}}
    ) {
      block {
        height
        timestamp {
          iso8601
        }
      }
      transaction {
        hash
      }
      tradeIndex
      buyCurrency {
        symbol
        address
        name
        tokenType
        decimals
      }
      buyAmount
      buyAmountUSD: buyAmount(in: USD)
      sellCurrency {
        symbol
        address
        name
        tokenType
        decimals
      }
      sellAmount
      sellAmountUSD: sellAmount(in: USD)
      usdPrice: expression(get: "buyAmountUSD / sellAmount")
      maker {
        address
      }
      taker {
        address
      }
      protocol
      exchange {
        address {
          address
        }
        name
      }
      smartContract {
        address {
          address
        }
      }
    }
  }
}

Variables

{
  "from": "2023-05-17T11:06:59.000Z",
  "to": "2023-05-17T12:21:59.000Z",
  "limit": 10
}

Similar queries