From 0408ad1095259d741b6d0592c7d25c654d7bc773 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 22 Feb 2025 08:21:24 +0100 Subject: [PATCH] fix: exception when rounded price is nan closes #11414 --- freqtrade/exchange/exchange_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange_utils.py b/freqtrade/exchange/exchange_utils.py index d20ff13f9..ad92033fb 100644 --- a/freqtrade/exchange/exchange_utils.py +++ b/freqtrade/exchange/exchange_utils.py @@ -4,7 +4,7 @@ Exchange support utils import inspect from datetime import datetime, timedelta, timezone -from math import ceil, floor +from math import ceil, floor, isnan from typing import Any import ccxt @@ -305,7 +305,7 @@ def price_to_precision( :param rounding_mode: rounding mode to use. Defaults to ROUND :return: price rounded up to the precision the Exchange accepts """ - if price_precision is not None and precisionMode is not None: + if price_precision is not None and precisionMode is not None and not isnan(price): if rounding_mode not in (ROUND_UP, ROUND_DOWN): # Use CCXT code where possible. return float(