Wrong buyCurrency in the dexTrades API

Hello!

I am using the dexTrades API to get the latest trades but I noticed that there is an issue when there are 3 tokens in the path.
For example the tx on bsc : 0xe3fcd41f849bb53a47757e95bea67d7e13ee3838ead34fd73ac2ea506656012e. The Belt token was sold in WBNB then it was converted to BUSD, however the api returned that the buyCurrency was WBNB and the sellCurrency was BUSD.

Here is the answer I got:

      {
        "transaction": {
          "hash": "0xe3fcd41f849bb53a47757e95bea67d7e13ee3838ead34fd73ac2ea506656012e",
          "txFrom": {
            "address": "0x52ad3d04585f2766346db9870ab037547cfa9b38"
          }
        },
        "tradeIndex": "8",
        "date": {
          "date": "2021-08-22"
        },
        "buyAmount": 444.46066048002575,
        "buyAmountInUsd": 200250.33451198574,
        "buyCurrency": {
          "symbol": "WBNB"
        },
        "sellAmount": 199830.04943165768,
        "sellCurrency": {
          "symbol": "BUSD",
          "address": "0xe9e7cea3dedca5984780bafc599bd69add087d56"
        },
        "sellAmountInUsd": 200173.96184521247,
        "tradeAmount": 200173.96184521247,
        "taker": {
          "smartContract": {
            "contractType": null
          }
        }
      },

and this is the query I used:

{
  ethereum(network: bsc) {
    dexTrades(
      options: { limit: 2000, desc: "tradeAmount" }
      date: { after: "2021-08-15" }
      takerSmartContractType: { is: None }
      tradeAmountUsd: {gt: 200000}
    ) {
      transaction {
        hash
        txFrom{
          address
        }
      }
      tradeIndex
      date {
        date
      }
      
      buyAmount
      buyAmountInUsd: buyAmount(in: USD)
      buyCurrency {
        symbol
      }
      sellAmount
      sellCurrency {
        symbol
        address
      }
      sellAmountInUsd: sellAmount(in: USD)
      tradeAmount(in: USD)
      taker {
        smartContract {
          contractType
        }
      }
    }
  }
}

So basically you are saying that the token was sold in WBNB (which is basically, buyCurrency) and then it was converted to BUSD. Are talking about it getting converted to BUSD in the buyCurrency side?

At the end the token was sold in BUSD, so buyCurrency should be BUSD. Also, I think that BELT should be in sellCurrency instead of BUSD

Thank you for this information, can you name the source of this information. Like from where are you cross-checking?

I used https://bscscan.com/ to check the data. I hope this issue will be fixed soon!

In AMMs there are not sell or buy, there are just swaps.

While swapping you can’t decide user is buying or selling, because he is just swapping.

Therefore, this is on your end how you query our data and which querying which currency you are using as buyCurrency and sellCurrency.

Or try mentioning buy or sell currency once and then swap it… see what results you see.

1 Like

Thanks @gaurav for your response but I think there is a misunderstanding. The tx above is a swap from Belt to Busd. However the api says it’s a swap from WBNB to BUSD with no mention of Belt . Isn’t it an issue?

Yes… We will check @sayon please create a ticket for this.

Alright. I am on it.