pub struct BacktestConfigBuilder { /* private fields */ }Expand description
Builder for BacktestConfig. Validates on Self::build.
Implementations§
Source§impl BacktestConfigBuilder
impl BacktestConfigBuilder
Sourcepub fn symbol(self, sym: impl Into<Symbol>) -> Self
pub fn symbol(self, sym: impl Into<Symbol>) -> Self
Single symbol to backtest. Convenience wrapper — equivalent to
calling Self::symbols with a one-element vector. Repeated
calls replace any previously set symbols.
Sourcepub fn symbols<I, S>(self, syms: I) -> Self
pub fn symbols<I, S>(self, syms: I) -> Self
Set the full symbol list. The brain will see events for all listed symbols and is responsible for filtering. At least one symbol is required.
Sourcepub fn initial_cash(self, cash: f64) -> Self
pub fn initial_cash(self, cash: f64) -> Self
Override the starting cash balance (default 10_000.0).
Sourcepub fn sizing(self, sizing: SizingConfig) -> Self
pub fn sizing(self, sizing: SizingConfig) -> Self
Override the position-sizing config.
Sourcepub fn slippage(self, m: SlippageModel) -> Self
pub fn slippage(self, m: SlippageModel) -> Self
Override the slippage model (default Zero).
Sourcepub fn contract_value(self, cv: f64) -> Self
pub fn contract_value(self, cv: f64) -> Self
Override the contract multiplier (default 1.0 — spot).
Sourcepub fn risk_free_rate(self, r: f64) -> Self
pub fn risk_free_rate(self, r: f64) -> Self
Per-period risk-free rate for Sharpe / Sortino (default 0.0).
See BacktestConfig::risk_free_rate for the expected scaling.
Sourcepub fn periods_per_year(self, n: u32) -> Self
pub fn periods_per_year(self, n: u32) -> Self
Annualisation factor for Sharpe / Sortino (default 252).
See BacktestConfig::periods_per_year for the typical cadences.
Sourcepub fn session_pnl(self, cfg: SessionPnlConfig) -> Self
pub fn session_pnl(self, cfg: SessionPnlConfig) -> Self
Enable the per-symbol session-PnL halt during replay (off by
default). Use the same SessionPnlConfig the live bot runs with
so the backtest reproduces live gating.
Sourcepub fn circuit_breaker(self, cfg: CircuitBreakerConfig) -> Self
pub fn circuit_breaker(self, cfg: CircuitBreakerConfig) -> Self
Enable the per-symbol circuit breaker during replay (off by
default). Use the same CircuitBreakerConfig the live bot runs
with so the backtest reproduces live gating.
Sourcepub fn build(self) -> Result<BacktestConfig>
pub fn build(self) -> Result<BacktestConfig>
Validate and build. Returns Error::Config on any constraint
violation.
Trait Implementations§
Source§impl Clone for BacktestConfigBuilder
impl Clone for BacktestConfigBuilder
Source§fn clone(&self) -> BacktestConfigBuilder
fn clone(&self) -> BacktestConfigBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more