core: when backtest finishes, any open positions should now close at bar.last

This commit is contained in:
KhizarImran
2026-06-13 23:28:49 +01:00
parent 9847a99561
commit a039484b08
+3
View File
@@ -25,6 +25,9 @@ impl Engine {
strategy.next(bar, &mut self.broker);
self.equity_curve.push(self.broker.equity(bar.close));
}
if let Some(last_bar) = self.data.last() {
self.broker.close_all(last_bar.close, last_bar.timestamp);
}
Stats::compute(&self.broker, &self.equity_curve)
}
}