mirror of
https://github.com/KhizarImran/backtestingfx.git
synced 2026-07-27 20:17:44 +00:00
core: when backtest finishes, any open positions should now close at bar.last
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user