Custom sell -> Custom exit
This commit is contained in:
parent
cc8dd76879
commit
15db16797e
@ -78,7 +78,7 @@ Freqtrade will fall back to the `proposed_stake` value should your code raise an
|
|||||||
!!! Tip
|
!!! Tip
|
||||||
Returning `0` or `None` will prevent trades from being placed.
|
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.
|
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"
|
!!! 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.
|
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.
|
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
|
## Custom order timeout rules
|
||||||
|
|
||||||
|
@ -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,
|
def custom_exit(self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float,
|
||||||
current_profit: float, **kwargs) -> 'Optional[Union[str, bool]]':
|
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
|
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.
|
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,
|
example you could implement a sell relative to the candle when the trade was opened,
|
||||||
or a custom 1:2 risk-reward ROI.
|
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 pair: Pair that's currently analyzed
|
||||||
:param trade: trade object.
|
:param trade: trade object.
|
||||||
|
@ -507,7 +507,7 @@ def test_custom_exit(default_conf, fee, caplog) -> None:
|
|||||||
assert res.exit_type == ExitType.CUSTOM_EXIT
|
assert res.exit_type == ExitType.CUSTOM_EXIT
|
||||||
assert res.exit_flag is True
|
assert res.exit_flag is True
|
||||||
assert res.exit_reason == 'h' * 64
|
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)
|
@pytest.mark.parametrize('side', TRADE_SIDES)
|
||||||
|
Loading…
Reference in New Issue
Block a user