A bug in the digital accuracy of the currency's disks

Author: leemon, Created: 2021-07-15 23:39:47, Updated:

Below is the information about the unfinished orders returned. [{Info:{symbol:ALICEUSDT,status:PARTIALLY_FILLED,clientOrderId:x-PtW46NoE_20FD0D3794C8F944,executedQty:1.3,cumQuote:10.4819,type:LIMIT,reduceOnly:false,order:708818902,price:8.063,avgPrice:8.0630,originalQty:11.6,ClosePosition:false,26063321712,44side:SELLPROTECTION,ProtectionType:LITRICET1:01.01.PricePriceProtectionType:PRACT1:01.PRACT1:01.PRACT1:01.PRACT1:01.PRACT1:0.PRACT1:0.03,03,03,0

The number of pending orders shown above is 11.6, but only 1.3 are transacted, and then the number of pending orders is sold again. But the two digits srvOrder.Amount - srvOrder.DealAmount subtracted from each other turned out to be 10.299999999999, instead of 10.3. The following accuracy overflow errors occur:

Sell(8.054, 10.299999999999): 400: {“code”:-1111,“msg”:“Precision is over the maximum defined for this asset.”}

The language used is JavaScript.


More

17602119359/upload/asset/185ac34677b649d192c6e.jpg The same issue has also been raised, in the forum as if you raised the issue, in a facelift, asking how to solve it ~

AAA386I'm trying to get more precise, some currency exchangeinfo calls are wrong, re-create the array, add in.

The grassYes, JS and Python have this problem.

czruiAn interesting accuracy bug: Log ((0.056+0.52) is a bug in the log.

The grassPrecision can be set in the language parameters

ouroborosThe same problem is facing the Malay language, how can we solve it?

17602119359I'm going to try it.

leemonIf the price of 126.0783 has four decimal places, but the currency can only support up to three decimal places, then it is wrong.

The grassMost of them are problematic, so it is recommended to save them with a string.

leemonThe precision can be adjusted, but if the intercept had been 10.3, it would have been 10.2, and the exchangeinfo call error was temporarily avoided.

leemonWhy is this a bug? There is also a problem with database access data, for example, this value 1626332174485 is stored in the database, the background view of the value is fine with the SQLite command, but the code reading it out the value becomes like 1626332174380, the last few digits have changed, the database access large numbers basically have this problem.