Rename stoploss_reached to ft_stoploss_reached
This commit is contained in:
parent
ce7d24f529
commit
cdd324d0a9
@ -1083,7 +1083,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
|
|
||||||
trade.adjust_min_max_rates(high or current_rate, low or current_rate)
|
trade.adjust_min_max_rates(high or current_rate, low or current_rate)
|
||||||
|
|
||||||
stoplossflag = self.stop_loss_reached(current_rate=current_rate, trade=trade,
|
stoplossflag = self.ft_stoploss_reached(current_rate=current_rate, trade=trade,
|
||||||
current_time=current_time,
|
current_time=current_time,
|
||||||
current_profit=current_profit,
|
current_profit=current_profit,
|
||||||
force_stoploss=force_stoploss, low=low, high=high)
|
force_stoploss=force_stoploss, low=low, high=high)
|
||||||
@ -1204,7 +1204,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
|
|
||||||
trade.adjust_stop_loss(bound or current_rate, stop_loss_value)
|
trade.adjust_stop_loss(bound or current_rate, stop_loss_value)
|
||||||
|
|
||||||
def stop_loss_reached(self, current_rate: float, trade: Trade,
|
def ft_stoploss_reached(self, current_rate: float, trade: Trade,
|
||||||
current_time: datetime, current_profit: float,
|
current_time: datetime, current_profit: float,
|
||||||
force_stoploss: float, low: Optional[float] = None,
|
force_stoploss: float, low: Optional[float] = None,
|
||||||
high: Optional[float] = None) -> ExitCheckTuple:
|
high: Optional[float] = None) -> ExitCheckTuple:
|
||||||
|
@ -452,7 +452,7 @@ def test_min_roi_reached3(default_conf, fee) -> None:
|
|||||||
(0.05, 0.9, ExitType.NONE, None, False, True, 0.09, 0.9, ExitType.NONE,
|
(0.05, 0.9, ExitType.NONE, None, False, True, 0.09, 0.9, ExitType.NONE,
|
||||||
lambda **kwargs: None),
|
lambda **kwargs: None),
|
||||||
])
|
])
|
||||||
def test_stop_loss_reached(default_conf, fee, profit, adjusted, expected, liq, trailing, custom,
|
def test_ft_stoploss_reached(default_conf, fee, profit, adjusted, expected, liq, trailing, custom,
|
||||||
profit2, adjusted2, expected2, custom_stop) -> None:
|
profit2, adjusted2, expected2, custom_stop) -> None:
|
||||||
|
|
||||||
strategy = StrategyResolver.load_strategy(default_conf)
|
strategy = StrategyResolver.load_strategy(default_conf)
|
||||||
@ -477,7 +477,7 @@ def test_stop_loss_reached(default_conf, fee, profit, adjusted, expected, liq, t
|
|||||||
|
|
||||||
now = arrow.utcnow().datetime
|
now = arrow.utcnow().datetime
|
||||||
current_rate = trade.open_rate * (1 + profit)
|
current_rate = trade.open_rate * (1 + profit)
|
||||||
sl_flag = strategy.stop_loss_reached(current_rate=current_rate, trade=trade,
|
sl_flag = strategy.ft_stoploss_reached(current_rate=current_rate, trade=trade,
|
||||||
current_time=now, current_profit=profit,
|
current_time=now, current_profit=profit,
|
||||||
force_stoploss=0, high=None)
|
force_stoploss=0, high=None)
|
||||||
assert isinstance(sl_flag, ExitCheckTuple)
|
assert isinstance(sl_flag, ExitCheckTuple)
|
||||||
@ -489,7 +489,7 @@ def test_stop_loss_reached(default_conf, fee, profit, adjusted, expected, liq, t
|
|||||||
assert round(trade.stop_loss, 2) == adjusted
|
assert round(trade.stop_loss, 2) == adjusted
|
||||||
current_rate2 = trade.open_rate * (1 + profit2)
|
current_rate2 = trade.open_rate * (1 + profit2)
|
||||||
|
|
||||||
sl_flag = strategy.stop_loss_reached(current_rate=current_rate2, trade=trade,
|
sl_flag = strategy.ft_stoploss_reached(current_rate=current_rate2, trade=trade,
|
||||||
current_time=now, current_profit=profit2,
|
current_time=now, current_profit=profit2,
|
||||||
force_stoploss=0, high=None)
|
force_stoploss=0, high=None)
|
||||||
assert sl_flag.exit_type == expected2
|
assert sl_flag.exit_type == expected2
|
||||||
@ -579,7 +579,7 @@ def test_should_sell(default_conf, fee) -> None:
|
|||||||
assert res == [ExitCheckTuple(exit_type=ExitType.ROI)]
|
assert res == [ExitCheckTuple(exit_type=ExitType.ROI)]
|
||||||
|
|
||||||
strategy.min_roi_reached = MagicMock(return_value=True)
|
strategy.min_roi_reached = MagicMock(return_value=True)
|
||||||
strategy.stop_loss_reached = MagicMock(
|
strategy.ft_stoploss_reached = MagicMock(
|
||||||
return_value=ExitCheckTuple(exit_type=ExitType.STOP_LOSS))
|
return_value=ExitCheckTuple(exit_type=ExitType.STOP_LOSS))
|
||||||
|
|
||||||
res = strategy.should_exit(trade, 1, now,
|
res = strategy.should_exit(trade, 1, now,
|
||||||
@ -603,7 +603,7 @@ def test_should_sell(default_conf, fee) -> None:
|
|||||||
ExitCheckTuple(exit_type=ExitType.ROI),
|
ExitCheckTuple(exit_type=ExitType.ROI),
|
||||||
]
|
]
|
||||||
|
|
||||||
strategy.stop_loss_reached = MagicMock(
|
strategy.ft_stoploss_reached = MagicMock(
|
||||||
return_value=ExitCheckTuple(exit_type=ExitType.TRAILING_STOP_LOSS))
|
return_value=ExitCheckTuple(exit_type=ExitType.TRAILING_STOP_LOSS))
|
||||||
# Regular exit signal
|
# Regular exit signal
|
||||||
res = strategy.should_exit(trade, 1, now,
|
res = strategy.should_exit(trade, 1, now,
|
||||||
|
@ -3902,7 +3902,7 @@ def test_exit_profit_only(
|
|||||||
if exit_type == ExitType.EXIT_SIGNAL.value:
|
if exit_type == ExitType.EXIT_SIGNAL.value:
|
||||||
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
|
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
|
||||||
else:
|
else:
|
||||||
freqtrade.strategy.stop_loss_reached = MagicMock(return_value=ExitCheckTuple(
|
freqtrade.strategy.ft_stoploss_reached = MagicMock(return_value=ExitCheckTuple(
|
||||||
exit_type=ExitType.NONE))
|
exit_type=ExitType.NONE))
|
||||||
freqtrade.enter_positions()
|
freqtrade.enter_positions()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user