sell_signal -> exit_signal

This commit is contained in:
Matthias
2022-04-04 17:10:02 +02:00
parent 1917527179
commit 6d9218cb34
15 changed files with 40 additions and 40 deletions

View File

@@ -470,7 +470,7 @@ class Edge:
if len(ohlc_columns) - 1 < exit_index:
break
exit_type = ExitType.SELL_SIGNAL
exit_type = ExitType.EXIT_SIGNAL
exit_price = ohlc_columns[exit_index, 0]
trade = {'pair': pair,

View File

@@ -9,7 +9,7 @@ class ExitType(Enum):
STOP_LOSS = "stop_loss"
STOPLOSS_ON_EXCHANGE = "stoploss_on_exchange"
TRAILING_STOP_LOSS = "trailing_stop_loss"
SELL_SIGNAL = "sell_signal"
EXIT_SIGNAL = "exit_signal"
FORCE_EXIT = "force_exit"
EMERGENCY_EXIT = "emergency_exit"
CUSTOM_EXIT = "custom_exit"

View File

@@ -529,7 +529,7 @@ class Backtesting:
# call the custom exit price,with default value as previous closerate
current_profit = trade.calc_profit_ratio(closerate)
order_type = self.strategy.order_types['exit']
if sell.exit_type in (ExitType.SELL_SIGNAL, ExitType.CUSTOM_EXIT):
if sell.exit_type in (ExitType.EXIT_SIGNAL, ExitType.CUSTOM_EXIT):
# Custom exit pricing only for sell-signals
if order_type == 'limit':
closerate = strategy_safe_wrapper(self.strategy.custom_exit_price,

View File

@@ -768,7 +768,7 @@ class Telegram(RPCHandler):
'stop_loss': 'Stoploss',
'trailing_stop_loss': 'Trail. Stop',
'stoploss_on_exchange': 'Stoploss',
'sell_signal': 'Sell Signal',
'exit_signal': 'Exit Signal',
'force_exit': 'Force Exit',
'emergency_exit': 'Emergency Exit',
}

View File

@@ -308,7 +308,7 @@ class IStrategy(ABC, HyperStrategyMixin):
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
:param exit_reason: Exit reason.
Can be any of ['roi', 'stop_loss', 'stoploss_on_exchange', 'trailing_stop_loss',
'sell_signal', 'force_exit', 'emergency_exit']
'exit_signal', 'force_exit', 'emergency_exit']
:param current_time: datetime object, containing the current datetime
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
:return bool: When True, then the exit-order is placed on the exchange.
@@ -888,7 +888,7 @@ class IStrategy(ABC, HyperStrategyMixin):
pass
elif self.use_sell_signal and not enter:
if exit_:
exit_signal = ExitType.SELL_SIGNAL
exit_signal = ExitType.EXIT_SIGNAL
else:
trade_type = "exit_short" if trade.is_short else "sell"
custom_reason = strategy_safe_wrapper(self.custom_exit, default_retval=False)(
@@ -904,7 +904,7 @@ class IStrategy(ABC, HyperStrategyMixin):
custom_reason = custom_reason[:CUSTOM_EXIT_MAX_LENGTH]
else:
custom_reason = None
if exit_signal in (ExitType.CUSTOM_EXIT, ExitType.SELL_SIGNAL):
if exit_signal in (ExitType.CUSTOM_EXIT, ExitType.EXIT_SIGNAL):
logger.debug(f"{trade.pair} - Sell signal received. "
f"exit_type=ExitType.{exit_signal.name}" +
(f", custom_reason={custom_reason}" if custom_reason else ""))

View File

@@ -162,7 +162,7 @@ def confirm_trade_exit(self, pair: str, trade: 'Trade', order_type: str, amount:
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
:param exit_reason: Exit reason.
Can be any of ['roi', 'stop_loss', 'stoploss_on_exchange', 'trailing_stop_loss',
'sell_signal', 'force_exit', 'emergency_exit']
'exit_signal', 'force_exit', 'emergency_exit']
:param current_time: datetime object, containing the current datetime
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
:return bool: When True is returned, then the exit-order is placed on the exchange.