OctoBot-Tentacles icon indicating copy to clipboard operation
OctoBot-Tentacles copied to clipboard

[StaggeredOrders] handle very low prices

Open GuillaumeDSM opened this issue 6 years ago • 1 comments

problem: python number rounding when very low prices can make huge differences

GuillaumeDSM avatar May 08 '19 23:05 GuillaumeDSM

Even when prices are not very short numbers there are issues with floating point numbers:

Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 2.3+2.4
4.699999999999999

That can be fixed with the decimal module for eg:

>>> from decimal import Decimal
>>> Decimal('2.3')+Decimal('2.4')
Decimal('4.7')

damajor avatar Mar 14 '21 23:03 damajor