commit
cff002f21c
@ -7,6 +7,7 @@ import traceback
|
||||
from datetime import datetime, timezone
|
||||
from math import isclose
|
||||
from threading import Lock
|
||||
from decimal import Decimal
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from freqtrade import __version__, constants
|
||||
@ -481,7 +482,8 @@ class FreqtradeBot(LoggingMixin):
|
||||
|
||||
if stake_amount is not None and stake_amount < 0.0:
|
||||
# We should decrease our position
|
||||
amount = abs(stake_amount) / current_exit_rate
|
||||
# Strategy should return value as Decimal.
|
||||
amount = abs(float(Decimal(stake_amount) / Decimal(current_exit_rate)))
|
||||
if trade.amount - amount < min_stake_amount:
|
||||
logger.info('Remaining amount would be too small')
|
||||
return
|
||||
|
@ -2055,8 +2055,9 @@ def test_get_sell_rate_orderbook_exception(default_conf, mocker, caplog):
|
||||
exchange = get_patched_exchange(mocker, default_conf)
|
||||
with pytest.raises(PricingError):
|
||||
exchange.get_rate(pair, refresh=True, side="sell")
|
||||
assert log_has_re(rf"{pair} - Sell Price at location 1 from orderbook could not be determined\..*",
|
||||
caplog)
|
||||
assert log_has_re(
|
||||
rf"{pair} - Sell Price at location 1 from orderbook "
|
||||
rf"could not be determined\..*", caplog)
|
||||
|
||||
|
||||
def test_get_sell_rate_exception(default_conf, mocker, caplog):
|
||||
|
Loading…
Reference in New Issue
Block a user