mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-03 02:23:05 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user