DEX prices

Returns the latest DEX trade on Ethereum, where pair smart contract is 0x9c4f…7c4c and block number is at most 21929720: buy currency symbol, buy fungible, buy currency name, buy smart contract, buy price, sell currency symbol, sell fungible and 5 more fields.

By Francesco Gasparetto · saved 12 March 2025 · run 5 times · Bitquery API v2

What it returns

Filters

The query

query dexPrices($contract: String!, $block: String!) {
  EVM(network: eth, dataset: archive) {
    DEXTrades(
      orderBy: {descending: Block_Time}
      where: {Trade: {Dex: {Pair: {SmartContract: {is: $contract}}}}, TransactionStatus: {Success: true}, Block: {Number: {le: $block}}}
      limit: {count: 1}
    ) {
      Trade {
        Buy {
          Currency {
            Symbol
            Fungible
            Name
            SmartContract
          }
          Price_against_sell_currency: Price
        }
        Sell {
          Currency {
            Symbol
            Symbol
            Fungible
            Name
            SmartContract
          }
        }
      }
      Block {
        Date
        Number
      }
      Transaction {
        Hash
      }
    }
  }
}

Variables

{
  "contract":"0x9c4fe5ffd9a9fc5678cfbd93aa2d4fd684b67c4c",
  "block": "21929720"
}

Similar queries