Drakkar-Software / OctoBot-Tentacles

This repository contains public tentacles (packages) for the OctoBot project

Home Page:https://www.octobot.cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[StaggeredOrders] handle very low prices

GuillaumeDSM opened this issue · comments

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

commented

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')