emergency_sell -> emergency_exit
This commit is contained in:
parent
54ad130bb9
commit
cd146bfa8f
@ -143,7 +143,7 @@
|
|||||||
"buy_fill": "on",
|
"buy_fill": "on",
|
||||||
"sell": {
|
"sell": {
|
||||||
"roi": "off",
|
"roi": "off",
|
||||||
"emergency_sell": "off",
|
"emergency_exit": "off",
|
||||||
"force_exit": "off",
|
"force_exit": "off",
|
||||||
"sell_signal": "off",
|
"sell_signal": "off",
|
||||||
"trailing_stop_loss": "off",
|
"trailing_stop_loss": "off",
|
||||||
|
@ -564,7 +564,7 @@ class AwesomeStrategy(IStrategy):
|
|||||||
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
|
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
|
||||||
:param exit_reason: Exit reason.
|
:param exit_reason: Exit reason.
|
||||||
Can be any of ['roi', 'stop_loss', 'stoploss_on_exchange', 'trailing_stop_loss',
|
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 current_time: datetime object, containing the current datetime
|
||||||
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
|
: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.
|
:return bool: When True is returned, then the exit-order is placed on the exchange.
|
||||||
|
@ -84,7 +84,7 @@ Example configuration showing the different settings:
|
|||||||
"buy": "silent",
|
"buy": "silent",
|
||||||
"sell": {
|
"sell": {
|
||||||
"roi": "silent",
|
"roi": "silent",
|
||||||
"emergency_sell": "on",
|
"emergency_exit": "on",
|
||||||
"force_exit": "on",
|
"force_exit": "on",
|
||||||
"sell_signal": "silent",
|
"sell_signal": "silent",
|
||||||
"trailing_stop_loss": "on",
|
"trailing_stop_loss": "on",
|
||||||
|
@ -11,7 +11,7 @@ class ExitType(Enum):
|
|||||||
TRAILING_STOP_LOSS = "trailing_stop_loss"
|
TRAILING_STOP_LOSS = "trailing_stop_loss"
|
||||||
SELL_SIGNAL = "sell_signal"
|
SELL_SIGNAL = "sell_signal"
|
||||||
FORCE_EXIT = "force_exit"
|
FORCE_EXIT = "force_exit"
|
||||||
EMERGENCY_SELL = "emergency_sell"
|
EMERGENCY_EXIT = "emergency_exit"
|
||||||
CUSTOM_SELL = "custom_sell"
|
CUSTOM_SELL = "custom_sell"
|
||||||
NONE = ""
|
NONE = ""
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
logger.error(f'Unable to place a stoploss order on exchange. {e}')
|
logger.error(f'Unable to place a stoploss order on exchange. {e}')
|
||||||
logger.warning('Exiting the trade forcefully')
|
logger.warning('Exiting the trade forcefully')
|
||||||
self.execute_trade_exit(trade, trade.stop_loss, exit_check=ExitCheckTuple(
|
self.execute_trade_exit(trade, trade.stop_loss, exit_check=ExitCheckTuple(
|
||||||
exit_type=ExitType.EMERGENCY_SELL))
|
exit_type=ExitType.EMERGENCY_EXIT))
|
||||||
|
|
||||||
except ExchangeError:
|
except ExchangeError:
|
||||||
trade.stoploss_order_id = None
|
trade.stoploss_order_id = None
|
||||||
@ -1162,7 +1162,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
try:
|
try:
|
||||||
self.execute_trade_exit(
|
self.execute_trade_exit(
|
||||||
trade, order.get('price'),
|
trade, order.get('price'),
|
||||||
exit_check=ExitCheckTuple(exit_type=ExitType.EMERGENCY_SELL))
|
exit_check=ExitCheckTuple(exit_type=ExitType.EMERGENCY_EXIT))
|
||||||
except DependencyException as exception:
|
except DependencyException as exception:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f'Unable to emergency sell trade {trade.pair}: {exception}')
|
f'Unable to emergency sell trade {trade.pair}: {exception}')
|
||||||
@ -1380,7 +1380,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
trade = self.cancel_stoploss_on_exchange(trade)
|
trade = self.cancel_stoploss_on_exchange(trade)
|
||||||
|
|
||||||
order_type = ordertype or self.strategy.order_types[exit_type]
|
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!)
|
# Emergency sells (default to market!)
|
||||||
order_type = self.strategy.order_types.get("emergencyexit", "market")
|
order_type = self.strategy.order_types.get("emergencyexit", "market")
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ class Telegram(RPCHandler):
|
|||||||
'stoploss_on_exchange': 'Stoploss',
|
'stoploss_on_exchange': 'Stoploss',
|
||||||
'sell_signal': 'Sell Signal',
|
'sell_signal': 'Sell Signal',
|
||||||
'force_exit': 'Force Exit',
|
'force_exit': 'Force Exit',
|
||||||
'emergency_sell': 'Emergency Sell',
|
'emergency_exit': 'Emergency Exit',
|
||||||
}
|
}
|
||||||
exit_reasons_tabulate = [
|
exit_reasons_tabulate = [
|
||||||
[
|
[
|
||||||
|
@ -308,7 +308,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
|
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
|
||||||
:param exit_reason: Exit reason.
|
:param exit_reason: Exit reason.
|
||||||
Can be any of ['roi', 'stop_loss', 'stoploss_on_exchange', 'trailing_stop_loss',
|
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 current_time: datetime object, containing the current datetime
|
||||||
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
|
: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.
|
:return bool: When True, then the exit-order is placed on the exchange.
|
||||||
|
@ -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 time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
|
||||||
:param exit_reason: Exit reason.
|
:param exit_reason: Exit reason.
|
||||||
Can be any of ['roi', 'stop_loss', 'stoploss_on_exchange', 'trailing_stop_loss',
|
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 current_time: datetime object, containing the current datetime
|
||||||
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
|
: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.
|
:return bool: When True is returned, then the exit-order is placed on the exchange.
|
||||||
|
@ -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 freqtrade.handle_stoploss_on_exchange(trade) is False
|
||||||
assert trade.stoploss_order_id is None
|
assert trade.stoploss_order_id is None
|
||||||
assert trade.is_open is False
|
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])
|
@pytest.mark.parametrize("is_short", [False, True])
|
||||||
@ -1293,7 +1293,7 @@ def test_create_stoploss_order_invalid_order(
|
|||||||
caplog.clear()
|
caplog.clear()
|
||||||
freqtrade.create_stoploss_order(trade, 200)
|
freqtrade.create_stoploss_order(trade, 200)
|
||||||
assert trade.stoploss_order_id is None
|
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("Unable to place a stoploss order on exchange. ", caplog)
|
||||||
assert log_has("Exiting the trade forcefully", 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
|
# Rpc is sending first buy, then sell
|
||||||
assert rpc_mock.call_count == 2
|
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'
|
assert rpc_mock.call_args_list[1][0][0]['order_type'] == 'market'
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user