How to do i query and specify contract addresses for Trade Volume (USDT) and Gas Fees (BNB) of certain contract addresses

im trying to calculate the monthly Trade Volume (USDT) and Gas Fees (in BNB) of a set of contract addresses ( ~10 addresses) for the last two months of October and November 2021

im new to graphql and not sure how to query - im thinking something like the query below (using 2 eg addresses) , but there are some things i am unsure about:

  • do i put the contract addresses into “TxSender”, “TxTo” , or both? where do i specify all the ~10 contract addresses ?
  • how do I aggregate (think GROUP BY in SQL terms) the Gas Fees and Trade Volume at the month level ?

thank you!

query ($network: EthereumNetwork!, $dateFormat: String!, $from: ISO8601DateTime, $till: ISO8601DateTime) {
  ethereum(network: $network) {
    transactions(options: {asc: "date.date"}, date: {since: $from, till: $till}) {
      date: date {
        date(format: $dateFormat)
      }
      txs: count
      dau: count(uniq: senders)
      gasValue(
        txSender: {in: ["0x491E59c255C790D4e3a53CEC2632524088f1aaA4", "0xd09649117110AA7a02dd5fB670219F385c43f88a"]}
      )
    }
  }
}

Use query like below

{
  ethereum(network: bsc) {
    dexTrades(
      date: {since: "2021-12-01", till: "2021-11-30"}
      smartContractAddress: {is: "0x491E59c255C790D4e3a53CEC2632524088f1aaA4"}
    ) {
      date: date {
        date(format: "%Y-%m")
      }
      trades: countBigInt
      tradeVolume: tradeAmount(in: USDT)
      gasValueVol: gasValue(calculate: sum)
    }
  }
}

For Ethereum what units are the gas values quoted in?
The results are for a liquidity pair address. What counts as a trade here? eg. a swap, a mint, a burn. And what does the volume represent in the case for this liquidity pool. Volume swapped?

“date”: {
“date”: “2020-08”
},
“trades”: “3”,
“tradeVolume”: 39.416872327387736,
“gasValueVol”: 0.02882401676034048
},

thanks! may i know why ur query is so different from mine - i.e. u use ‘dexTrades’, whereas i simply use ‘Transactions’

also the query i tried returns no results… whats happening?

use the correct contract address.

It depends on what you are trying to query.