mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
fix: use precise calculation for decrease adjustment calculations
This commit is contained in:
parent
c28446dad0
commit
ad295946c0
|
@ -62,7 +62,7 @@ from freqtrade.rpc.rpc_types import (
|
||||||
)
|
)
|
||||||
from freqtrade.strategy.interface import IStrategy
|
from freqtrade.strategy.interface import IStrategy
|
||||||
from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper
|
from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper
|
||||||
from freqtrade.util import MeasureTime
|
from freqtrade.util import FtPrecise, MeasureTime
|
||||||
from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names
|
from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names
|
||||||
from freqtrade.wallets import Wallets
|
from freqtrade.wallets import Wallets
|
||||||
|
|
||||||
|
@ -784,7 +784,14 @@ 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 = self.exchange.amount_to_contract_precision(
|
amount = self.exchange.amount_to_contract_precision(
|
||||||
trade.pair, abs(float(stake_amount * trade.amount / trade.stake_amount))
|
trade.pair,
|
||||||
|
abs(
|
||||||
|
float(
|
||||||
|
FtPrecise(stake_amount)
|
||||||
|
* FtPrecise(trade.amount)
|
||||||
|
/ FtPrecise(trade.stake_amount)
|
||||||
|
)
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if amount == 0.0:
|
if amount == 0.0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user