Use supress_errors in strategy wrapper - ensure it's called once
This commit is contained in:
parent
c047e48a47
commit
dea7e3db01
@ -151,7 +151,7 @@ class FreqtradeBot:
|
|||||||
self.dataprovider.refresh(self.pairlists.create_pair_list(self.active_pair_whitelist),
|
self.dataprovider.refresh(self.pairlists.create_pair_list(self.active_pair_whitelist),
|
||||||
self.strategy.informative_pairs())
|
self.strategy.informative_pairs())
|
||||||
|
|
||||||
strategy_safe_wrapper(self.strategy.bot_loop_start)()
|
strategy_safe_wrapper(self.strategy.bot_loop_start, supress_error=True)()
|
||||||
|
|
||||||
self.strategy.analyze(self.active_pair_whitelist)
|
self.strategy.analyze(self.active_pair_whitelist)
|
||||||
|
|
||||||
|
@ -1964,6 +1964,18 @@ def test_close_trade(default_conf, ticker, limit_buy_order, limit_sell_order,
|
|||||||
freqtrade.handle_trade(trade)
|
freqtrade.handle_trade(trade)
|
||||||
|
|
||||||
|
|
||||||
|
def test_bot_loop_start_called_once(mocker, default_conf, caplog):
|
||||||
|
ftbot = get_patched_freqtradebot(mocker, default_conf)
|
||||||
|
patch_get_signal(ftbot)
|
||||||
|
ftbot.strategy.bot_loop_start = MagicMock(side_effect=ValueError)
|
||||||
|
ftbot.strategy.analyze = MagicMock()
|
||||||
|
|
||||||
|
ftbot.process()
|
||||||
|
assert log_has_re(r'Strategy caused the following exception.*', caplog)
|
||||||
|
assert ftbot.strategy.bot_loop_start.call_count == 1
|
||||||
|
assert ftbot.strategy.analyze.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_check_handle_timedout_buy_usercustom(default_conf, ticker, limit_buy_order_old, open_trade,
|
def test_check_handle_timedout_buy_usercustom(default_conf, ticker, limit_buy_order_old, open_trade,
|
||||||
fee, mocker) -> None:
|
fee, mocker) -> None:
|
||||||
default_conf["unfilledtimeout"] = {"buy": 1400, "sell": 30}
|
default_conf["unfilledtimeout"] = {"buy": 1400, "sell": 30}
|
||||||
|
Loading…
Reference in New Issue
Block a user