move "add_bt_trade" call for entries into enter_trade function

This commit is contained in:
Matthias
2024-05-04 09:14:56 +02:00
parent c81c07c24a
commit ee7be1cd5a
2 changed files with 6 additions and 3 deletions

View File

@@ -964,6 +964,7 @@ class Backtesting:
contract_size=contract_size,
orders=[],
)
LocalTrade.add_bt_trade(trade)
trade.adjust_stop_loss(trade.open_rate, self.strategy.stoploss, initial=True)
@@ -1196,8 +1197,6 @@ class Backtesting:
# This emulates previous behavior - not sure if this is correct
# Prevents entering if the trade-slot was freed in this candle
open_trade_count_start += 1
# logger.debug(f"{pair} - Emulate creation of new trade: {trade}.")
LocalTrade.add_bt_trade(trade)
self.wallets.update()
else:
self._collate_rejected(pair, row)