# Tokens transfers amount rounded or not accurate (floating point)

**URL:** <https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520>\
**Category:** GraphQL API\
**Created:** [June 11, 2023, 11:31pm UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520 "2023-06-11T23:31:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.bitquery.io/lyes/32/751_2.png) [@lyes](https://community.bitquery.io/u/lyes)\
**Post date:** [June 11, 2023, 11:31pm UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520/1 "2023-06-11T23:31:41Z")

</div>

Hello,

I have a serious problem with the data returned with ETH and BSC transfers, the amount number (tokens transfered) is rounded and sometimes not even accurate with big decimals (float) when it should never be rounded for accuracy reasons.

Here is an example with BSC:

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

Expected transfer value :  
**5049.28034264**  
Returned by Bitquery :  
**5049.2803426400005**

Which is innacurate and probably a floating point problem caused by the programming language ( see website: floating-point-gui [dot] de/basic/ ).

Another example with ETH:

> **[Ethereum Transaction Hash (Txhash) Details | Etherscan](https://etherscan.io/tx/0x02cbdf74994c7912aa39cfe1629f22df322e736ca2f0382aca5202f40f444168)**
>
> Ethereum (ETH) detailed transaction info for txhash 0x02cbdf74994c7912aa39cfe1629f22df322e736ca2f0382aca5202f40f444168. The transaction status, block confirmation, gas fee, Ether (ETH), and token transfer are shown.

Many transfers amounts are not returned correctly with this one.

Expected:  
**19.110343473122736641** swETH  
Returned by bitquery :  
**19.11034347312274** swETH

As you can see, it’s rounded.

Here is the graphql query used:

```auto
query ($network: EthereumNetwork!, $hash: String!, $limit: Int!, $offset: Int!) {
  ethereum(network: $network) {
    transfers(
      options: {limit: $limit, offset: $offset}
      amount: {gteq: 0}
      txHash: {is: $hash}
    ) {
      sender {
        address
      }
      receiver {
        address
      }
      amount
      currency {
        symbol
        address
        tokenType
        name
      }
      gasValue
      }
    }
  }
}

```

the params:

```auto
{
  "limit": 25,
  "offset": 0,
  "network": "ethereum",
  "hash": "0x02cbdf74994c7912aa39cfe1629f22df322e736ca2f0382aca5202f40f444168"
}

```

This is a huge issue and I would appreciate if it can be fixed.

Thanks for your help.  
Regards

---

<div class="post-metadata">

**Author:** ![Divya](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@Divya](https://community.bitquery.io/u/Divya)\
**Post date:** [June 12, 2023, 7:10am UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520/2 "2023-06-12T07:10:22Z")

</div>

Thanks for raising this issue. I have created a ticket to bring it to the notice of the dev team. Will get back to you with the fix/response.

---

<div class="post-metadata">

**Author:** ![Divya](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@Divya](https://community.bitquery.io/u/Divya)\
**Post date:** [June 14, 2023, 9:41am UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520/3 "2023-06-14T09:41:19Z")

</div>

@lyes For correct floating point values use the new dataset [https://ide.bitquery.io/streaming\_transaction-floating-point](https://ide.bitquery.io/streaming_transaction-floating-point)

This is recorded as a known issue in the dataset that you are using.

---

<div class="post-metadata">

**Author:** ![lyes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.bitquery.io/lyes/32/751_2.png) [@lyes](https://community.bitquery.io/u/lyes)\
**Post date:** [June 19, 2023, 1:29am UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520/4 "2023-06-19T01:29:03Z")

</div>

Thank’s for your response.

The new dataset works fine and the data returned is much more accurate.

However I’m facing a new issue:

I can’t find a way to return the transfer amount in USD with this new dataset like I used to do before:

```auto
{
  ethereum(network: ethereum) {
    transfers(
      options: {limit: 10}
    ) {
      amount 
      amountInUSD: amount(in: USD)
    }
  }
}

```

Can you help me? is there any documentation online regarding this new dataset that can help?

Thank’s again!

---

<div class="post-metadata">

**Author:** ![Divya](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@Divya](https://community.bitquery.io/u/Divya)\
**Post date:** [June 19, 2023, 6:14am UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520/5 "2023-06-19T06:14:06Z")

</div>

You can find the documentation here [https://docs.bitquery.io/](https://docs.bitquery.io/)

I will check if we can get transfers in USD in the new dataset.

---

<div class="post-metadata">

**Author:** ![lyes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.bitquery.io/lyes/32/751_2.png) [@lyes](https://community.bitquery.io/u/lyes)\
**Post date:** [June 23, 2023, 12:00am UTC](https://community.bitquery.io/t/tokens-transfers-amount-rounded-or-not-accurate-floating-point/1520/6 "2023-06-23T00:00:06Z")

</div>

Thanks for the docs, I can’t find anything related to what I’m searching for inside.

I would really appreciate if you can get back to me for a solution to get transfers in USD in the new dataset.
