# Wrong buyCurrency in the dexTrades API

**URL:** <https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432>\
**Category:** GraphQL API\
**Tags:** open\
**Created:** [August 22, 2021, 4:45pm UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432 "2021-08-22T16:45:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnUser](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@AnUser](https://community.bitquery.io/u/AnUser)\
**Post date:** [August 22, 2021, 4:45pm UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/1 "2021-08-22T16:45:06Z")

</div>

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:

```json
      {
        "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:

```auto
{
  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
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [August 23, 2021, 3:16am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/2 "2021-08-23T03:16:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![AnUser](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@AnUser](https://community.bitquery.io/u/AnUser)\
**Post date:** [August 23, 2021, 8:46am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/3 "2021-08-23T08:46:13Z")

</div>

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**

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [August 23, 2021, 10:41am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/4 "2021-08-23T10:41:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AnUser](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@AnUser](https://community.bitquery.io/u/AnUser)\
**Post date:** [August 23, 2021, 10:58am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/5 "2021-08-23T10:58:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [August 24, 2021, 11:03am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/6 "2021-08-24T11:03:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AnUser](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@AnUser](https://community.bitquery.io/u/AnUser)\
**Post date:** [August 24, 2021, 11:10am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/7 "2021-08-24T11:10:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [September 10, 2021, 6:15am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/8 "2021-09-10T06:15:54Z")

</div>

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

> **[Binance Transaction Hash (Txhash) Details | BscScan](https://bscscan.com/tx/0xe3fcd41f849bb53a47757e95bea67d7e13ee3838ead34fd73ac2ea506656012e)**
>
> Binance (BNB) detailed transaction info for txhash 0xe3fcd41f849bb53a47757e95bea67d7e13ee3838ead34fd73ac2ea506656012e. The transaction status, block confirmation, gas fee, BNB, and token transfer are shown.

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [September 10, 2021, 7:13am UTC](https://community.bitquery.io/t/wrong-buycurrency-in-the-dextrades-api/432/9 "2021-09-10T07:13:42Z")

</div>

Alright. I am on it.
