diff --git a/piker/pp.py b/piker/pp.py index b4ab2d0c..1e4cd014 100644 --- a/piker/pp.py +++ b/piker/pp.py @@ -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, diff --git a/tests/test_paper.py b/tests/test_paper.py index 3339db6c..f8a7fd24 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -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