mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Extract some assert values from bt test
This commit is contained in:
@@ -940,9 +940,12 @@ def test_backtest_one_detail_futures(
|
|||||||
# assert late_entry > 0
|
# 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(
|
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['use_exit_signal'] = False
|
||||||
default_conf_usdt['trading_mode'] = 'futures'
|
default_conf_usdt['trading_mode'] = 'futures'
|
||||||
default_conf_usdt['margin_mode'] = 'isolated'
|
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)
|
assert ff_spy.call_count == (324 if use_detail else 27)
|
||||||
|
|
||||||
for t in Trade.trades:
|
for t in Trade.trades:
|
||||||
# At least 4 adjustment orders
|
# At least 6 adjustment orders
|
||||||
assert t.nr_of_successful_entries >= 6
|
assert t.nr_of_successful_entries == entries
|
||||||
# Funding fees will vary depending on the number of adjustment orders
|
# Funding fees will vary depending on the number of adjustment orders
|
||||||
# That number is a lot higher with detail data.
|
# That number is a lot higher with detail data.
|
||||||
|
assert t.max_stake_amount == max_stake
|
||||||
assert -1.81 < t.funding_fees < -0.1
|
assert -1.81 < t.funding_fees < -0.1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user