Fixed float dust bug on zero position case

decimalization_take_2
Guillermo Rodriguez 2023-02-27 16:47:02 -03:00
parent 269a04ba1a
commit dc78994dcf
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
2 changed files with 3 additions and 3 deletions

View File

@ -22,6 +22,7 @@ that doesn't try to cuk most humans who prefer to not lose their moneys..
'''
from __future__ import annotations
from contextlib import contextmanager as cm
from decimal import Decimal, ROUND_HALF_EVEN
from pprint import pformat
import os
from os import path
@ -466,7 +467,8 @@ class Position(Struct):
if self.split_ratio is not None:
size = round(size * self.split_ratio)
return size
return float(Decimal(size).quantize(
Decimal('1.0000'), rounding=ROUND_HALF_EVEN))
def minimize_clears(
self,

View File

@ -206,8 +206,6 @@ def test_sell(
),
)
@pytest.mark.xfail(reason='Due to precision issues, this test will currently fail')
def test_multi_sell(
open_test_pikerd_and_ems: AsyncContextManager,
delete_testing_dir