pub struct PerformanceMetrics {
pub num_trades: f64,
pub win_rate: f64,
pub profit_factor: f64,
pub max_drawdown_pct: f64,
pub cagr: f64,
pub sharpe_ratio: f64,
pub sortino_ratio: f64,
pub total_return: f64,
pub final_equity: f64,
pub avg_trade_pnl: f64,
}Expand description
Summary performance statistics for a completed backtest run.
Fields§
§num_trades: f64§win_rate: f64§profit_factor: f64§max_drawdown_pct: f64§cagr: f64§sharpe_ratio: f64§sortino_ratio: f64§total_return: f64§final_equity: f64§avg_trade_pnl: f64Implementations§
Source§impl PerformanceMetrics
impl PerformanceMetrics
Sourcepub const fn column_names() -> &'static [&'static str]
pub const fn column_names() -> &'static [&'static str]
Column names for sweep / tabular export (stable order).
Sourcepub fn values(&self) -> [f64; 10]
pub fn values(&self) -> [f64; 10]
Metric values in Self::column_names order.
Sourcepub fn row_iter(&self) -> impl Iterator<Item = (&'static str, f64)>
pub fn row_iter(&self) -> impl Iterator<Item = (&'static str, f64)>
Iterate (column name, value) pairs for sweep row assembly.
Sourcepub fn from_result(result: &BacktestResult) -> Self
pub fn from_result(result: &BacktestResult) -> Self
Compute metrics from a BacktestResult.
Uses stats for initial/final equity when present; falls back to the
equity curve endpoints.
pub fn from_raw( trades: &[Trade], equity: &[EquityPoint], initial_cash: f64, ) -> Self
Trait Implementations§
Source§impl Clone for PerformanceMetrics
impl Clone for PerformanceMetrics
Source§fn clone(&self) -> PerformanceMetrics
fn clone(&self) -> PerformanceMetrics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PerformanceMetrics
impl Debug for PerformanceMetrics
Source§impl PartialEq for PerformanceMetrics
impl PartialEq for PerformanceMetrics
Source§fn eq(&self, other: &PerformanceMetrics) -> bool
fn eq(&self, other: &PerformanceMetrics) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PerformanceMetrics
Auto Trait Implementations§
impl Freeze for PerformanceMetrics
impl RefUnwindSafe for PerformanceMetrics
impl Send for PerformanceMetrics
impl Sync for PerformanceMetrics
impl Unpin for PerformanceMetrics
impl UnsafeUnpin for PerformanceMetrics
impl UnwindSafe for PerformanceMetrics
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.