used decimal

This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி 2022-03-19 17:18:03 +05:30 committed by GitHub
parent d62c86840f
commit 9fc0f8797d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import traceback
from datetime import datetime, timezone from datetime import datetime, timezone
from math import isclose from math import isclose
from threading import Lock from threading import Lock
from decimal import Decimal
from typing import Any, Dict, List, Optional, Tuple from typing import Any, Dict, List, Optional, Tuple
from freqtrade import __version__, constants from freqtrade import __version__, constants
@ -481,7 +482,8 @@ class FreqtradeBot(LoggingMixin):
if stake_amount is not None and stake_amount < 0.0: if stake_amount is not None and stake_amount < 0.0:
# We should decrease our position # 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: if trade.amount - amount < min_stake_amount:
logger.info('Remaining amount would be too small') logger.info('Remaining amount would be too small')
return return