pub struct BacktestComparison { /* private fields */ }Expand description
Builder that accumulates BacktestResults and ranks them.
§Ordering
Call ranked_by to produce a
ComparisonReport sorted best-first by the chosen OptimizeMetric.
Implementations§
Source§impl BacktestComparison
impl BacktestComparison
Sourcepub fn add(self, label: impl Into<String>, result: BacktestResult) -> Self
pub fn add(self, label: impl Into<String>, result: BacktestResult) -> Self
Add a labelled backtest result.
The label is an arbitrary human-readable name (e.g. "SMA 10/50").
It does not have to match the strategy’s internal name.
Sourcepub fn ranked_by(self, metric: OptimizeMetric) -> ComparisonReport
pub fn ranked_by(self, metric: OptimizeMetric) -> ComparisonReport
Rank all added results by metric and return a ComparisonReport.
Results are sorted best-first (highest score wins for all metrics
except OptimizeMetric::MinDrawdown, which is already negated
internally so that a lower drawdown yields a higher score).
Trait Implementations§
Source§impl Debug for BacktestComparison
impl Debug for BacktestComparison
Source§impl Default for BacktestComparison
impl Default for BacktestComparison
Source§fn default() -> BacktestComparison
fn default() -> BacktestComparison
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BacktestComparison
impl !RefUnwindSafe for BacktestComparison
impl Send for BacktestComparison
impl Sync for BacktestComparison
impl Unpin for BacktestComparison
impl UnsafeUnpin for BacktestComparison
impl !UnwindSafe for BacktestComparison
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