Extract some assert values from bt test

This commit is contained in:
Matthias
2023-12-10 12:56:20 +01:00
parent cd09d3567f
commit 1d73b57e8c

View File

@@ -940,9 +940,12 @@ def test_backtest_one_detail_futures(
# assert late_entry > 0
@pytest.mark.parametrize('use_detail', [True, False])
@pytest.mark.parametrize('use_detail,entries,max_stake', [
(True, 50, 3000),
(False, 6, 360)])
def test_backtest_one_detail_futures_funding_fees(
default_conf_usdt, fee, mocker, testdatadir, use_detail) -> None:
default_conf_usdt, fee, mocker, testdatadir, use_detail, entries, max_stake
) -> None:
default_conf_usdt['use_exit_signal'] = False
default_conf_usdt['trading_mode'] = 'futures'
default_conf_usdt['margin_mode'] = 'isolated'
@@ -1005,10 +1008,11 @@ def test_backtest_one_detail_futures_funding_fees(
assert ff_spy.call_count == (324 if use_detail else 27)
for t in Trade.trades:
# At least 4 adjustment orders
assert t.nr_of_successful_entries >= 6
# At least 6 adjustment orders
assert t.nr_of_successful_entries == entries
# Funding fees will vary depending on the number of adjustment orders
# That number is a lot higher with detail data.
assert t.max_stake_amount == max_stake
assert -1.81 < t.funding_fees < -0.1