BSC Query

Returns DEX trades and events on BNB Chain, where DEX smart contract is 0x28A4…1740 or 0xd01f…dcc7, log smart contract is 0x28A4…1740 or 0xd01f…dcc7 and signature name is Mint or Burn, sorted by block time: sum of trade buy amount, sum of trade sell amount, sum of trade buy amount in USD, sum of trade sell amount in USD, buy amount, buy amount in USD, buy price and 30 more fields.

By Madx · saved 13 November 2024 · Bitquery API v2

What it returns

Filters

The query

query GetTrades($pools: [String!], $fromBlock: String!, $toBlock: String!) {
  EVM(dataset: combined, network: bsc) {
    DEXTrades(
      where: {Block: {Number: {ge: $fromBlock, le: $toBlock}}, Trade: {Dex: {SmartContract: {in: $pools}}}}
      orderBy: {ascending: Block_Time}
    ) {
      buy_vol: sum(of: Trade_Buy_Amount)
      sell_vol: sum(of: Trade_Sell_Amount)
      buy_vol_usd: sum(of: Trade_Buy_AmountInUSD)
      sell_vol_usd: sum(of: Trade_Sell_AmountInUSD)
      Trade {
        Buy {
          Amount
          AmountInUSD
          Price
          PriceInUSD
          Buyer
          Seller
          Currency {
            Name
            SmartContract
          }
        }
        Sell {
          AmountInUSD
          PriceInUSD
          Price
          Amount
          Buyer
          Seller
          Currency {
            Name
            SmartContract
          }
        }
        Dex {
          SmartContract
        }
      }
      Transaction {
        Hash
      }
      Block {
        Time
        Number
      }
      Log {
        Signature {
          Name
        }
      }
    }
    Events(
      where: {Block: {Number: {ge: $fromBlock, le: $toBlock}}, Log: {SmartContract: {in: $pools}, Signature: {Name: {in: ["Mint", "Burn"]}}}}
      orderBy: {ascending: Block_Time}
    ) {
      Transaction {
        Hash
        From
        To
      }
      Block {
        Number
        Time
      }
      Log {
        Signature {
          Name
        }
        SmartContract
      }
      Transaction {
        From
        To
        Type
      }
      LogHeader {
        Address
        Index
      }
      Arguments {
        Value {
          ... on EVM_ABI_Integer_Value_Arg {
            integer
          }
          ... on EVM_ABI_String_Value_Arg {
            string
          }
          ... on EVM_ABI_Address_Value_Arg {
            address
          }
          ... on EVM_ABI_Boolean_Value_Arg {
            bool
          }
          ... on EVM_ABI_Bytes_Value_Arg {
            hex
          }
          ... on EVM_ABI_BigInt_Value_Arg {
            bigInteger
          }
        }
        Name
      }
    }
  }
}

Variables

{
  "pools": [
    "0x28A4Ea3BC63324486a8E3063AC78c019D17B1740",
    "0xd01ff1f3cd6df067b7f5863222267209c413dcc7"
  ],
  "fromBlock": "20860791",
  "toBlock": "21100730"
}

Similar queries