pub struct BacktestMetrics {
pub total_return: f64,
pub annualized_return: f64,
pub sharpe: f64,
pub sortino: f64,
pub max_drawdown: f64,
pub calmar: f64,
pub win_rate: f64,
pub profit_factor: f64,
pub avg_trade_return: f64,
pub num_trades: usize,
}Expand description
Summary performance metrics for a completed backtest.
Fields§
§total_return: f64Total return over the period: (final - initial) / initial.
annualized_return: f64Annualised return (assuming 252 trading days).
sharpe: f64Annualised Sharpe ratio (risk-free = 0).
sortino: f64Annualised Sortino ratio (downside deviation only).
max_drawdown: f64Maximum peak-to-trough drawdown as a fraction.
calmar: f64Calmar ratio: annualised return / max drawdown.
win_rate: f64Fraction of trades that were profitable.
profit_factor: f64Gross profit / gross loss.
avg_trade_return: f64Mean P&L per trade as a fraction of notional.
num_trades: usizeTotal number of completed round-trip trades.
Trait Implementations§
Source§impl Clone for BacktestMetrics
impl Clone for BacktestMetrics
Auto Trait Implementations§
impl Freeze for BacktestMetrics
impl RefUnwindSafe for BacktestMetrics
impl Send for BacktestMetrics
impl Sync for BacktestMetrics
impl Unpin for BacktestMetrics
impl UnsafeUnpin for BacktestMetrics
impl UnwindSafe for BacktestMetrics
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