Minor fix in amount_to_precision logic
This commit is contained in:
parent
c0bdb71810
commit
e818797427
@ -2855,8 +2855,10 @@ def amount_to_precision(amount: float, amount_precision: Optional[float],
|
|||||||
:return: truncated amount
|
:return: truncated amount
|
||||||
"""
|
"""
|
||||||
if amount_precision is not None and precisionMode is not None:
|
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,
|
amount = float(decimal_to_precision(amount, rounding_mode=TRUNCATE,
|
||||||
precision=amount_precision,
|
precision=precision,
|
||||||
counting_mode=precisionMode,
|
counting_mode=precisionMode,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -761,7 +761,7 @@ def test_rpc_force_exit(default_conf, ticker, fee, mocker) -> None:
|
|||||||
# and trade amount is updated
|
# and trade amount is updated
|
||||||
rpc._rpc_force_exit('3')
|
rpc._rpc_force_exit('3')
|
||||||
assert cancel_order_mock.call_count == 1
|
assert cancel_order_mock.call_count == 1
|
||||||
assert trade.amount == filled_amount
|
assert pytest.approx(trade.amount) == filled_amount
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'freqtrade.exchange.Exchange.fetch_order',
|
'freqtrade.exchange.Exchange.fetch_order',
|
||||||
|
Loading…
Reference in New Issue
Block a user