SELL_SIGNAL -> EXIT_SIGNAL

This commit is contained in:
Sam Germain
2022-01-04 23:00:42 -06:00
parent 0037754969
commit 93e332e506
9 changed files with 25 additions and 25 deletions

View File

@@ -464,7 +464,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 = "sell_signal"
FORCE_SELL = "force_sell"
EMERGENCY_SELL = "emergency_sell"
CUSTOM_SELL = "custom_sell"

View File

@@ -395,7 +395,7 @@ class Backtesting:
closerate = self._get_close_rate(sell_row, trade, sell, trade_dur)
# call the custom exit price,with default value as previous closerate
current_profit = trade.calc_profit_ratio(closerate)
if sell.exit_type in (ExitType.SELL_SIGNAL, ExitType.CUSTOM_SELL):
if sell.exit_type in (ExitType.EXIT_SIGNAL, ExitType.CUSTOM_SELL):
# Custom exit pricing only for sell-signals
closerate = strategy_safe_wrapper(self.strategy.custom_exit_price,
default_retval=closerate)(

View File

@@ -795,7 +795,7 @@ class IStrategy(ABC, HyperStrategyMixin):
pass
elif self.use_exit_signal and not enter:
if exit_:
sell_signal = ExitType.SELL_SIGNAL
sell_signal = ExitType.EXIT_SIGNAL
else:
trade_type = "exit_short" if trade.is_short else "sell"
custom_reason = strategy_safe_wrapper(self.custom_sell, default_retval=False)(
@@ -811,7 +811,7 @@ class IStrategy(ABC, HyperStrategyMixin):
custom_reason = custom_reason[:CUSTOM_SELL_MAX_LENGTH]
else:
custom_reason = None
if sell_signal in (ExitType.CUSTOM_SELL, ExitType.SELL_SIGNAL):
if sell_signal in (ExitType.CUSTOM_SELL, ExitType.EXIT_SIGNAL):
logger.debug(f"{trade.pair} - Sell signal received. "
f"exit_type=ExitType.{sell_signal.name}" +
(f", custom_reason={custom_reason}" if custom_reason else ""))