quick fix

This commit is contained in:
rextea 2021-03-16 19:27:49 +02:00
parent a5161ad433
commit 3a641a0ea9

View File

@ -32,7 +32,6 @@ from freqtrade.strategy.interface import IStrategy, SellType
from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper
from freqtrade.wallets import Wallets
logger = logging.getLogger(__name__)
@ -1141,12 +1140,7 @@ class FreqtradeBot(LoggingMixin):
:return: True if it succeeds (supported) False (not supported)
"""
sell_type = 'sell'
if sell_reason == SellType.STOP_LOSS:
sell_type = 'stoploss'
elif sell_reason == SellType.TRAILING_STOP_LOSS:
if 'trailing_stop_loss' in self.strategy.order_types:
sell_type = 'trailing_stop_loss'
else:
if sell_reason in (SellType.STOP_LOSS, SellType.TRAILING_STOP_LOSS):
sell_type = 'stoploss'
# if stoploss is on exchange and we are on dry_run mode,
@ -1163,10 +1157,13 @@ class FreqtradeBot(LoggingMixin):
logger.exception(f"Could not cancel stoploss order {trade.stoploss_order_id}")
order_type = self.strategy.order_types[sell_type]
if sell_reason == SellType.EMERGENCY_SELL:
if sell_reason == SellType.TRAILING_STOP_LOSS:
order_type = self.strategy.order_types.get("trailing_stop_loss", order_type)
elif sell_reason == SellType.EMERGENCY_SELL:
# Emergency sells (default to market!)
order_type = self.strategy.order_types.get("emergencysell", "market")
if sell_reason == SellType.FORCE_SELL:
elif sell_reason == SellType.FORCE_SELL:
# Force sells (default to the sell_type defined in the strategy,
# but we allow this value to be changed)
order_type = self.strategy.order_types.get("forcesell", order_type)