EMERGENCY_SELL -> EMERGENCY_EXIT

This commit is contained in:
Sam Germain 2022-01-04 23:09:35 -06:00
parent 7dbb1c8b75
commit ad9c5d96dc
3 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@ class ExitType(Enum):
TRAILING_STOP_LOSS = "trailing_stop_loss"
EXIT_SIGNAL = "exit_signal"
FORCE_EXIT = "force_exit"
EMERGENCY_SELL = "emergency_sell"
EMERGENCY_EXIT = "emergency_sell"
CUSTOM_SELL = "custom_sell"
NONE = ""

View File

@ -915,7 +915,7 @@ class FreqtradeBot(LoggingMixin):
logger.error(f'Unable to place a stoploss order on exchange. {e}')
logger.warning('Exiting the trade forcefully')
self.execute_trade_exit(trade, trade.stop_loss, exit_reason=ExitCheckTuple(
exit_type=ExitType.EMERGENCY_SELL))
exit_type=ExitType.EMERGENCY_EXIT))
except ExchangeError:
trade.stoploss_order_id = None
@ -1102,7 +1102,7 @@ class FreqtradeBot(LoggingMixin):
try:
self.execute_trade_exit(
trade, order.get('price'),
exit_reason=ExitCheckTuple(exit_type=ExitType.EMERGENCY_SELL))
exit_reason=ExitCheckTuple(exit_type=ExitType.EMERGENCY_EXIT))
except DependencyException as exception:
logger.warning(
f'Unable to emergency sell trade {trade.pair}: {exception}')
@ -1314,7 +1314,7 @@ class FreqtradeBot(LoggingMixin):
logger.exception(f"Could not cancel stoploss order {trade.stoploss_order_id}")
order_type = ordertype or self.strategy.order_types[exit_type]
if exit_reason.exit_type == ExitType.EMERGENCY_SELL:
if exit_reason.exit_type == ExitType.EMERGENCY_EXIT:
# Emergency sells (default to market!)
order_type = self.strategy.order_types.get("emergencysell", "market")

View File

@ -1164,7 +1164,7 @@ def test_create_stoploss_order_invalid_order(
caplog.clear()
freqtrade.create_stoploss_order(trade, 200)
assert trade.stoploss_order_id is None
assert trade.exit_reason == ExitType.EMERGENCY_SELL.value
assert trade.exit_reason == ExitType.EMERGENCY_EXIT.value
assert log_has("Unable to place a stoploss order on exchange. ", caplog)
assert log_has("Exiting the trade forcefully", caplog)
@ -1176,7 +1176,7 @@ def test_create_stoploss_order_invalid_order(
# Rpc is sending first buy, then sell
assert rpc_mock.call_count == 2
assert rpc_mock.call_args_list[1][0][0]['exit_reason'] == ExitType.EMERGENCY_SELL.value
assert rpc_mock.call_args_list[1][0][0]['exit_reason'] == ExitType.EMERGENCY_EXIT.value
assert rpc_mock.call_args_list[1][0][0]['order_type'] == 'market'