pub struct BacktestConfigBuilder { /* private fields */ }Expand description
Builder for BacktestConfig
Implementations§
Source§impl BacktestConfigBuilder
impl BacktestConfigBuilder
Sourcepub fn initial_capital(self, capital: f64) -> Self
pub fn initial_capital(self, capital: f64) -> Self
Set initial capital
Sourcepub fn commission(self, fee: f64) -> Self
pub fn commission(self, fee: f64) -> Self
Set flat commission per trade
Sourcepub fn commission_pct(self, pct: f64) -> Self
pub fn commission_pct(self, pct: f64) -> Self
Set commission as percentage of trade value
Sourcepub fn slippage_pct(self, pct: f64) -> Self
pub fn slippage_pct(self, pct: f64) -> Self
Set slippage as percentage of price
Sourcepub fn position_size_pct(self, pct: f64) -> Self
pub fn position_size_pct(self, pct: f64) -> Self
Set position size as fraction of available equity
Sourcepub fn max_positions(self, max: usize) -> Self
pub fn max_positions(self, max: usize) -> Self
Set maximum concurrent positions
Sourcepub fn unlimited_positions(self) -> Self
pub fn unlimited_positions(self) -> Self
Allow unlimited concurrent positions
Sourcepub fn allow_short(self, allow: bool) -> Self
pub fn allow_short(self, allow: bool) -> Self
Allow or disallow short selling
Sourcepub fn min_signal_strength(self, threshold: f64) -> Self
pub fn min_signal_strength(self, threshold: f64) -> Self
Set minimum signal strength threshold
Sourcepub fn stop_loss_pct(self, pct: f64) -> Self
pub fn stop_loss_pct(self, pct: f64) -> Self
Set stop-loss percentage (auto-exit if loss exceeds this)
Sourcepub fn take_profit_pct(self, pct: f64) -> Self
pub fn take_profit_pct(self, pct: f64) -> Self
Set take-profit percentage (auto-exit if profit exceeds this)
Sourcepub fn close_at_end(self, close: bool) -> Self
pub fn close_at_end(self, close: bool) -> Self
Set whether to close open positions at end of backtest
Sourcepub fn build(self) -> Result<BacktestConfig>
pub fn build(self) -> Result<BacktestConfig>
Build and validate the configuration
Trait Implementations§
Source§impl Default for BacktestConfigBuilder
impl Default for BacktestConfigBuilder
Source§fn default() -> BacktestConfigBuilder
fn default() -> BacktestConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BacktestConfigBuilder
impl RefUnwindSafe for BacktestConfigBuilder
impl Send for BacktestConfigBuilder
impl Sync for BacktestConfigBuilder
impl Unpin for BacktestConfigBuilder
impl UnsafeUnpin for BacktestConfigBuilder
impl UnwindSafe for BacktestConfigBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more