add filled time

This commit is contained in:
adriance
2022-03-09 23:55:57 +08:00
parent 14bce0b1c3
commit d579febfec
3 changed files with 10 additions and 4 deletions

View File

@@ -534,7 +534,7 @@ class Backtesting:
if sell.sell_flag:
trade.close_date = sell_candle_time
trade_dur = int((trade.close_date_utc - trade.filled_date_utc).total_seconds() // 60)
trade_dur = int((trade.close_date_utc - trade.buy_filled_date_utc).total_seconds() // 60)
try:
closerate = self._get_close_rate(sell_row, trade, sell, trade_dur)
except ValueError:
@@ -960,6 +960,7 @@ class Backtesting:
if order and self._get_order_filled(order.price, row):
order.close_bt_order(current_time)
trade.open_order_id = None
trade.buy_filled_date = current_time
LocalTrade.add_bt_trade(trade)
self.wallets.update()