Fixed float dust bug on zero position case
parent
269a04ba1a
commit
dc78994dcf
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue