From 15db16797ee54b760618bb56f10b2fb5e94a13c9 Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Tue, 4 Jan 2022 23:25:03 -0600 Subject: [PATCH] Custom sell -> Custom exit --- docs/strategy-callbacks.md | 4 ++-- freqtrade/templates/subtemplates/strategy_methods_advanced.j2 | 4 ++-- tests/strategy/test_interface.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index e14812654..c72c43e20 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -78,7 +78,7 @@ Freqtrade will fall back to the `proposed_stake` value should your code raise an !!! Tip Returning `0` or `None` will prevent trades from being placed. -## Custom sell signal +## Custom exit signal Called for open trade every throttling iteration (roughly every 5 seconds) until a trade is closed. @@ -391,7 +391,7 @@ class AwesomeStrategy(IStrategy): !!! Warning "Backtesting" While Custom prices are supported in backtesting (starting with 2021.12), prices will be moved to within the candle's high/low prices. This behavior is currently being tested, and might be changed at a later point. - `custom_exit_price()` is only called for sells of type Sell_signal and Custom sell. All other sell-types will use regular backtesting prices. + `custom_exit_price()` is only called for sells of type Sell_signal and Custom exit. All other sell-types will use regular backtesting prices. ## Custom order timeout rules diff --git a/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 b/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 index f26aeb30e..f4002e936 100644 --- a/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 +++ b/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 @@ -56,7 +56,7 @@ def custom_stoploss(self, pair: str, trade: 'Trade', current_time: 'datetime', def custom_exit(self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float, current_profit: float, **kwargs) -> 'Optional[Union[str, bool]]': """ - Custom sell signal logic indicating that specified position should be sold. Returning a + Custom exit signal logic indicating that specified position should be sold. Returning a string or True from this method is equal to setting sell signal on a candle at specified time. This method is not called when sell signal is set. @@ -64,7 +64,7 @@ def custom_exit(self, pair: str, trade: 'Trade', current_time: 'datetime', curre example you could implement a sell relative to the candle when the trade was opened, or a custom 1:2 risk-reward ROI. - Custom sell reason max length is 64. Exceeding characters will be removed. + Custom exit reason max length is 64. Exceeding characters will be removed. :param pair: Pair that's currently analyzed :param trade: trade object. diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index 00276246f..cf70ea078 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -507,7 +507,7 @@ def test_custom_exit(default_conf, fee, caplog) -> None: assert res.exit_type == ExitType.CUSTOM_EXIT assert res.exit_flag is True assert res.exit_reason == 'h' * 64 - assert log_has_re('Custom sell reason returned from custom_exit is too long.*', caplog) + assert log_has_re('Custom exit reason returned from custom_exit is too long.*', caplog) @pytest.mark.parametrize('side', TRADE_SIDES)