pub struct Backtester { /* private fields */ }Expand description
Bar-by-bar backtester.
Processes OHLCV bars in the supplied order, routes signals from Strategy::on_bar
into a PositionLedger, and records the equity curve.
Implementations§
Source§impl Backtester
impl Backtester
Sourcepub fn new(config: BacktestConfig) -> Self
pub fn new(config: BacktestConfig) -> Self
Creates a new backtester with the given config.
Sourcepub fn run(
&self,
bars: &[OhlcvBar],
strategy: &mut dyn Strategy,
) -> Result<BacktestResult, FinError>
pub fn run( &self, bars: &[OhlcvBar], strategy: &mut dyn Strategy, ) -> Result<BacktestResult, FinError>
Runs the backtest over bars using strategy.
§Errors
FinError::InvalidInputifbarsis empty.- Propagates
FinErrorfrom position accounting.
Auto Trait Implementations§
impl Freeze for Backtester
impl RefUnwindSafe for Backtester
impl Send for Backtester
impl Sync for Backtester
impl Unpin for Backtester
impl UnsafeUnpin for Backtester
impl UnwindSafe for Backtester
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more