Get total swaps for BNB and swaps to a token for a given time period

{
  ethereum(network: bsc) {
    dexTrades(
      sellCurrency: {is: "0x67fa5b3e9f15b793caae1dc2996de029ca45591c"}
      time: {since: "2021-06-29T12:50:00"}
      exchangeName: {in: ["Pancake", "Pancake v2"]}
      options: { desc: "sellAmount" }
    ) {
      buyCurrency {
        name
        symbol
        address
      }
      buyAmount
      sellAmount
    }
  }
}

The above query is meant to give me back the number of swaps that have happened for a particular token in BNB. So we can use it to track the volume of buys/sells. This will allows us to spot when private sellers are dumping a token of ours.

The above query returns two values for buys/sells and the amounts are identical and I suspect it’s only the sell amount, which is the swapExactTokensForETH. I also want to track SwapETHForTokens and convert both of those to dollar value.

1 - There is no concept of Buy/sell in AMMs, it’s just Swaps.

2 - If you mention the currency it will give you all the pairs data against that currency is swapped.

3- If you want to track trading volume of a currency check this query.

{
   ethereum (network: bsc) {
    dexTrades(
      exchangeName: {in: ["Pancake","Pancake v2"] },
      baseCurrency: {is:"0x67fa5b3e9f15b793caae1dc2996de029ca45591c"}
    ) {
      count
      tradeAmount(in:USD)
          
    }
  }
}

Is this answer your question.

1 Like