properly account for fee when assigning order.cost in backtesting

(although it's not relevant for operations, it shouldn't be obivously wrong).

closes #11003
This commit is contained in:
Matthias
2024-11-28 18:14:57 +01:00
parent cf9c9fe278
commit 5793216d5c
2 changed files with 2 additions and 2 deletions

View File

@@ -632,7 +632,7 @@ def test_backtest__enter_trade_futures(default_conf_usdt, fee, mocker) -> None:
trade = backtesting._enter_trade(pair, row=row, direction="short")
assert pytest.approx(trade.liquidation_price) == 0.11787191
assert pytest.approx(trade.orders[0].cost) == (
trade.stake_amount * trade.leverage + trade.fee_open
trade.stake_amount * trade.leverage * (1 + fee.return_value)
)
assert pytest.approx(trade.orders[-1].stake_amount) == trade.stake_amount