Minor fix in amount_to_precision logic

This commit is contained in:
Matthias
2022-08-15 20:29:05 +02:00
parent c0bdb71810
commit e818797427
2 changed files with 4 additions and 2 deletions

View File

@@ -2855,8 +2855,10 @@ def amount_to_precision(amount: float, amount_precision: Optional[float],
:return: truncated amount
"""
if amount_precision is not None and precisionMode is not None:
precision = int(amount_precision) if precisionMode != TICK_SIZE else amount_precision
# precision must be an int for non-ticksize inputs.
amount = float(decimal_to_precision(amount, rounding_mode=TRUNCATE,
precision=amount_precision,
precision=precision,
counting_mode=precisionMode,
))