From 4c91126c4978962cdf71bc26cc3cd447fb7ae99b Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Thu, 16 Sep 2021 03:23:45 -0600 Subject: [PATCH] some short freqtradebot parametrized tests --- freqtrade/freqtradebot.py | 6 ++++-- tests/test_freqtradebot.py | 11 +++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index ffd6f7546..9f58e3c36 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -812,8 +812,10 @@ class FreqtradeBot(LoggingMixin): exit_signal_type = "exit_short" if trade.is_short else "exit_long" # TODO-lev: change to use_exit_signal, ignore_roi_if_enter_signal - if (self.config.get('use_sell_signal', True) or - self.config.get('ignore_roi_if_buy_signal', False)): + if ( + self.config.get('use_sell_signal', True) or + self.config.get('ignore_roi_if_buy_signal', False) + ): analyzed_df, _ = self.dataprovider.get_analyzed_dataframe(trade.pair, self.strategy.timeframe) diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index cf7987ab0..2028ec6f8 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -4322,7 +4322,6 @@ def test_apply_fee_conditional(default_conf, fee, caplog, mocker, assert walletmock.call_count == 1 -@pytest.mark.parametrize("is_short", [False, True]) def test_order_book_depth_of_market(default_conf, ticker, limit_buy_order_open, limit_buy_order, is_short, fee, mocker, order_book_l2): default_conf['bid_strategy']['check_depth_of_market']['enabled'] = True @@ -4359,8 +4358,7 @@ def test_order_book_depth_of_market(default_conf, ticker, limit_buy_order_open, assert whitelist == default_conf['exchange']['pair_whitelist'] -@pytest.mark.parametrize("is_short", [False, True]) -def test_order_book_depth_of_market_high_delta(default_conf, ticker, limit_buy_order, is_short, +def test_order_book_depth_of_market_high_delta(default_conf, ticker, limit_buy_order, fee, mocker, order_book_l2): default_conf['bid_strategy']['check_depth_of_market']['enabled'] = True # delta is 100 which is impossible to reach. hence check_depth_of_market will return false @@ -4449,8 +4447,7 @@ def test_check_depth_of_market(default_conf, mocker, order_book_l2) -> None: assert freqtrade._check_depth_of_market('ETH/BTC', conf, side=SignalDirection.LONG) is False -@pytest.mark.parametrize("is_short", [False, True]) -def test_order_book_ask_strategy(default_conf, limit_buy_order_open, limit_buy_order, fee, is_short, +def test_order_book_ask_strategy(default_conf, limit_buy_order_open, limit_buy_order, fee, limit_sell_order_open, mocker, order_book_l2, caplog) -> None: """ test order book ask strategy @@ -4527,9 +4524,7 @@ def test_startup_trade_reinit(default_conf, edge_conf, mocker): @pytest.mark.usefixtures("init_persistence") -@pytest.mark.parametrize("is_short", [False, True]) -def test_sync_wallet_dry_run( - mocker, default_conf, ticker, fee, limit_buy_order_open, caplog, is_short): +def test_sync_wallet_dry_run(mocker, default_conf, ticker, fee, limit_buy_order_open, caplog): default_conf['dry_run'] = True # Initialize to 2 times stake amount default_conf['dry_run_wallet'] = 0.002