sell_profit_offset -> exit_profit_offset

This commit is contained in:
Sam Germain 2022-01-04 23:17:05 -06:00
parent 66cadcac01
commit cc8dd76879
11 changed files with 23 additions and 23 deletions

View File

@ -116,8 +116,8 @@ Mandatory parameters are marked as **Required**, which means that they are requi
| `ask_strategy.use_order_book` | Enable selling of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> **Datatype:** Boolean | `ask_strategy.use_order_book` | Enable selling of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> **Datatype:** Boolean
| `ask_strategy.order_book_top` | Bot will use the top N rate in Order Book "price_side" to sell. I.e. a value of 2 will allow the bot to pick the 2nd ask rate in [Order Book Asks](#sell-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer | `ask_strategy.order_book_top` | Bot will use the top N rate in Order Book "price_side" to sell. I.e. a value of 2 will allow the bot to pick the 2nd ask rate in [Order Book Asks](#sell-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
| `use_exit_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean | `use_exit_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean
| `exit_profit_only` | Wait until the bot reaches `sell_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean | `exit_profit_only` | Wait until the bot reaches `exit_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
| `sell_profit_offset` | Sell-signal is only active above this value. Only active in combination with `exit_profit_only=True`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio) | `exit_profit_offset` | Sell-signal is only active above this value. Only active in combination with `exit_profit_only=True`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
| `ignore_roi_if_enter_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_exit_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean | `ignore_roi_if_enter_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_exit_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
| `ignore_buying_expired_candle_after` | Specifies the number of seconds until a buy signal is no longer used. <br> **Datatype:** Integer | `ignore_buying_expired_candle_after` | Specifies the number of seconds until a buy signal is no longer used. <br> **Datatype:** Integer
| `order_types` | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Dict | `order_types` | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Dict
@ -195,7 +195,7 @@ Values set in the configuration file always overwrite values set in the strategy
* `disable_dataframe_checks` * `disable_dataframe_checks`
* `use_exit_signal` * `use_exit_signal`
* `exit_profit_only` * `exit_profit_only`
* `sell_profit_offset` * `exit_profit_offset`
* `ignore_roi_if_enter_signal` * `ignore_roi_if_enter_signal`
* `ignore_buying_expired_candle_after` * `ignore_buying_expired_candle_after`

View File

@ -89,7 +89,7 @@ For example you could implement a 1:2 risk-reward ROI with `custom_exit()`.
Using custom_exit() signals in place of stoploss though *is not recommended*. It is a inferior method to using `custom_stoploss()` in this regard - which also allows you to keep the stoploss on exchange. Using custom_exit() signals in place of stoploss though *is not recommended*. It is a inferior method to using `custom_stoploss()` in this regard - which also allows you to keep the stoploss on exchange.
!!! Note !!! Note
Returning a (none-empty) `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 already, or if sell signals are disabled (`use_exit_signal=False` or `exit_profit_only=True` while profit is below `sell_profit_offset`). `string` max length is 64 characters. Exceeding this limit will cause the message to be truncated to 64 characters. Returning a (none-empty) `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 already, or if sell signals are disabled (`use_exit_signal=False` or `exit_profit_only=True` while profit is below `exit_profit_offset`). `string` max length is 64 characters. Exceeding this limit will cause the message to be truncated to 64 characters.
An example of how we can use different indicators depending on the current profit and also sell trades that were open longer than one day: An example of how we can use different indicators depending on the current profit and also sell trades that were open longer than one day:

View File

@ -75,8 +75,8 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
None, 'use_exit_signal') None, 'use_exit_signal')
process_deprecated_setting(config, 'ask_strategy', 'exit_profit_only', process_deprecated_setting(config, 'ask_strategy', 'exit_profit_only',
None, 'exit_profit_only') None, 'exit_profit_only')
process_deprecated_setting(config, 'ask_strategy', 'sell_profit_offset', process_deprecated_setting(config, 'ask_strategy', 'exit_profit_offset',
None, 'sell_profit_offset') None, 'exit_profit_offset')
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_enter_signal', process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_enter_signal',
None, 'ignore_roi_if_enter_signal') None, 'ignore_roi_if_enter_signal')
process_deprecated_setting(config, 'ask_strategy', 'ignore_buying_expired_candle_after', process_deprecated_setting(config, 'ask_strategy', 'ignore_buying_expired_candle_after',

View File

@ -149,7 +149,7 @@ CONF_SCHEMA = {
'trailing_only_offset_is_reached': {'type': 'boolean'}, 'trailing_only_offset_is_reached': {'type': 'boolean'},
'use_exit_signal': {'type': 'boolean'}, 'use_exit_signal': {'type': 'boolean'},
'exit_profit_only': {'type': 'boolean'}, 'exit_profit_only': {'type': 'boolean'},
'sell_profit_offset': {'type': 'number'}, 'exit_profit_offset': {'type': 'number'},
'ignore_roi_if_enter_signal': {'type': 'boolean'}, 'ignore_roi_if_enter_signal': {'type': 'boolean'},
'ignore_buying_expired_candle_after': {'type': 'number'}, 'ignore_buying_expired_candle_after': {'type': 'number'},
'trading_mode': {'type': 'string', 'enum': TRADING_MODES}, 'trading_mode': {'type': 'string', 'enum': TRADING_MODES},

View File

@ -461,7 +461,7 @@ def generate_strategy_stats(btdata: Dict[str, DataFrame],
'minimal_roi': config['minimal_roi'], 'minimal_roi': config['minimal_roi'],
'use_exit_signal': config['use_exit_signal'], 'use_exit_signal': config['use_exit_signal'],
'exit_profit_only': config['exit_profit_only'], 'exit_profit_only': config['exit_profit_only'],
'sell_profit_offset': config['sell_profit_offset'], 'exit_profit_offset': config['exit_profit_offset'],
'ignore_roi_if_enter_signal': config['ignore_roi_if_enter_signal'], 'ignore_roi_if_enter_signal': config['ignore_roi_if_enter_signal'],
**daily_stats, **daily_stats,
**trade_stats **trade_stats

View File

@ -94,7 +94,7 @@ class StrategyResolver(IResolver):
("use_exit_signal", True), ("use_exit_signal", True),
("exit_profit_only", False), ("exit_profit_only", False),
("ignore_roi_if_enter_signal", False), ("ignore_roi_if_enter_signal", False),
("sell_profit_offset", 0.0), ("exit_profit_offset", 0.0),
("disable_dataframe_checks", False), ("disable_dataframe_checks", False),
("ignore_buying_expired_candle_after", 0) ("ignore_buying_expired_candle_after", 0)
] ]

View File

@ -103,7 +103,7 @@ class IStrategy(ABC, HyperStrategyMixin):
use_exit_signal: bool use_exit_signal: bool
exit_profit_only: bool exit_profit_only: bool
sell_profit_offset: float exit_profit_offset: float
ignore_roi_if_enter_signal: bool ignore_roi_if_enter_signal: bool
# Number of seconds after which the candle will no longer result in a buy on expired candles # Number of seconds after which the candle will no longer result in a buy on expired candles
@ -790,7 +790,7 @@ class IStrategy(ABC, HyperStrategyMixin):
current_rate = rate current_rate = rate
current_profit = trade.calc_profit_ratio(current_rate) current_profit = trade.calc_profit_ratio(current_rate)
if (self.exit_profit_only and current_profit <= self.sell_profit_offset): if (self.exit_profit_only and current_profit <= self.exit_profit_offset):
# exit_profit_only and profit doesn't reach the offset - ignore sell signal # exit_profit_only and profit doesn't reach the offset - ignore sell signal
pass pass
elif self.use_exit_signal and not enter: elif self.use_exit_signal and not enter:

View File

@ -987,7 +987,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
default_conf.update({ default_conf.update({
"use_exit_signal": True, "use_exit_signal": True,
"exit_profit_only": False, "exit_profit_only": False,
"sell_profit_offset": 0.0, "exit_profit_offset": 0.0,
"ignore_roi_if_enter_signal": False, "ignore_roi_if_enter_signal": False,
}) })
patch_exchange(mocker) patch_exchange(mocker)
@ -1062,7 +1062,7 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat
default_conf.update({ default_conf.update({
"use_exit_signal": True, "use_exit_signal": True,
"exit_profit_only": False, "exit_profit_only": False,
"sell_profit_offset": 0.0, "exit_profit_offset": 0.0,
"ignore_roi_if_enter_signal": False, "ignore_roi_if_enter_signal": False,
}) })
patch_exchange(mocker) patch_exchange(mocker)
@ -1174,7 +1174,7 @@ def test_backtest_start_multi_strat_nomock_detail(default_conf, mocker,
default_conf.update({ default_conf.update({
"use_exit_signal": True, "use_exit_signal": True,
"exit_profit_only": False, "exit_profit_only": False,
"sell_profit_offset": 0.0, "exit_profit_offset": 0.0,
"ignore_roi_if_enter_signal": False, "ignore_roi_if_enter_signal": False,
}) })
patch_exchange(mocker) patch_exchange(mocker)

View File

@ -1122,8 +1122,8 @@ def test_pairlist_resolving_fallback(mocker):
None, "use_exit_signal", False), None, "use_exit_signal", False),
("ask_strategy", "exit_profit_only", True, ("ask_strategy", "exit_profit_only", True,
None, "exit_profit_only", False), None, "exit_profit_only", False),
("ask_strategy", "sell_profit_offset", 0.1, ("ask_strategy", "exit_profit_offset", 0.1,
None, "sell_profit_offset", 0.01), None, "exit_profit_offset", 0.01),
("ask_strategy", "ignore_roi_if_enter_signal", True, ("ask_strategy", "ignore_roi_if_enter_signal", True,
None, "ignore_roi_if_enter_signal", False), None, "ignore_roi_if_enter_signal", False),
("ask_strategy", "ignore_buying_expired_candle_after", 5, ("ask_strategy", "ignore_buying_expired_candle_after", 5,

View File

@ -3437,7 +3437,7 @@ def test_exit_profit_only(
default_conf_usdt.update({ default_conf_usdt.update({
'use_exit_signal': True, 'use_exit_signal': True,
'exit_profit_only': profit_only, 'exit_profit_only': profit_only,
'sell_profit_offset': 0.1, 'exit_profit_offset': 0.1,
}) })
freqtrade = FreqtradeBot(default_conf_usdt) freqtrade = FreqtradeBot(default_conf_usdt)
patch_get_signal(freqtrade, enter_short=is_short, enter_long=not is_short) patch_get_signal(freqtrade, enter_short=is_short, enter_long=not is_short)
@ -3456,7 +3456,7 @@ def test_exit_profit_only(
assert freqtrade.handle_trade(trade) is handle_first assert freqtrade.handle_trade(trade) is handle_first
if handle_second: if handle_second:
freqtrade.strategy.sell_profit_offset = 0.0 freqtrade.strategy.exit_profit_offset = 0.0
assert freqtrade.handle_trade(trade) is True assert freqtrade.handle_trade(trade) is True

File diff suppressed because one or more lines are too long