emergency_sell -> emergency_exit

This commit is contained in:
Matthias 2022-04-04 17:03:27 +02:00
parent 54ad130bb9
commit cd146bfa8f
9 changed files with 13 additions and 13 deletions

View File

@ -143,7 +143,7 @@
"buy_fill": "on",
"sell": {
"roi": "off",
"emergency_sell": "off",
"emergency_exit": "off",
"force_exit": "off",
"sell_signal": "off",
"trailing_stop_loss": "off",

View File

@ -564,7 +564,7 @@ class AwesomeStrategy(IStrategy):
: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_sell']
'sell_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.

View File

@ -84,7 +84,7 @@ Example configuration showing the different settings:
"buy": "silent",
"sell": {
"roi": "silent",
"emergency_sell": "on",
"emergency_exit": "on",
"force_exit": "on",
"sell_signal": "silent",
"trailing_stop_loss": "on",

View File

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

View File

@ -981,7 +981,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_check=ExitCheckTuple(
exit_type=ExitType.EMERGENCY_SELL))
exit_type=ExitType.EMERGENCY_EXIT))
except ExchangeError:
trade.stoploss_order_id = None
@ -1162,7 +1162,7 @@ class FreqtradeBot(LoggingMixin):
try:
self.execute_trade_exit(
trade, order.get('price'),
exit_check=ExitCheckTuple(exit_type=ExitType.EMERGENCY_SELL))
exit_check=ExitCheckTuple(exit_type=ExitType.EMERGENCY_EXIT))
except DependencyException as exception:
logger.warning(
f'Unable to emergency sell trade {trade.pair}: {exception}')
@ -1380,7 +1380,7 @@ class FreqtradeBot(LoggingMixin):
trade = self.cancel_stoploss_on_exchange(trade)
order_type = ordertype or self.strategy.order_types[exit_type]
if exit_check.exit_type == ExitType.EMERGENCY_SELL:
if exit_check.exit_type == ExitType.EMERGENCY_EXIT:
# Emergency sells (default to market!)
order_type = self.strategy.order_types.get("emergencyexit", "market")

View File

@ -770,7 +770,7 @@ class Telegram(RPCHandler):
'stoploss_on_exchange': 'Stoploss',
'sell_signal': 'Sell Signal',
'force_exit': 'Force Exit',
'emergency_sell': 'Emergency Sell',
'emergency_exit': 'Emergency Exit',
}
exit_reasons_tabulate = [
[

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_sell']
'sell_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.

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_sell']
'sell_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.

View File

@ -1210,7 +1210,7 @@ def test_handle_stoploss_on_exchange(mocker, default_conf_usdt, fee, caplog, is_
assert freqtrade.handle_stoploss_on_exchange(trade) is False
assert trade.stoploss_order_id is None
assert trade.is_open is False
assert trade.exit_reason == str(ExitType.EMERGENCY_SELL)
assert trade.exit_reason == str(ExitType.EMERGENCY_EXIT)
@pytest.mark.parametrize("is_short", [False, True])
@ -1293,7 +1293,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)
@ -1305,7 +1305,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]['sell_reason'] == ExitType.EMERGENCY_SELL.value
assert rpc_mock.call_args_list[1][0][0]['sell_reason'] == ExitType.EMERGENCY_EXIT.value
assert rpc_mock.call_args_list[1][0][0]['order_type'] == 'market'