pub struct PerformanceTracker { /* private fields */ }Expand description
Incremental performance tracker.
Implementations§
Source§impl PerformanceTracker
impl PerformanceTracker
Sourcepub fn new(
mode: impl Into<String>,
starting_balance_usdc: Option<Decimal>,
instrument: Option<InstrumentId>,
) -> Self
pub fn new( mode: impl Into<String>, starting_balance_usdc: Option<Decimal>, instrument: Option<InstrumentId>, ) -> Self
Create a tracker for one run mode and optional starting balance.
Sourcepub fn set_instrument(&mut self, instrument: InstrumentId)
pub fn set_instrument(&mut self, instrument: InstrumentId)
Set the instrument if it has not already been set.
Sourcepub fn record_equity_point(
&mut self,
ts_ms: i64,
price: Option<Decimal>,
net_pnl: Decimal,
)
pub fn record_equity_point( &mut self, ts_ms: i64, price: Option<Decimal>, net_pnl: Decimal, )
Record a new equity point.
Sourcepub fn snapshot(
&self,
fills: &[OrderFilledEvent],
positions: &[Position],
) -> PerformanceMetricsSnapshot
pub fn snapshot( &self, fills: &[OrderFilledEvent], positions: &[Position], ) -> PerformanceMetricsSnapshot
Build a full performance snapshot from fills and positions.
Sourcepub fn equity_curve(&self) -> Vec<BacktestEquityPoint>
pub fn equity_curve(&self) -> Vec<BacktestEquityPoint>
Return a copy of the equity curve.
Sourcepub fn closed_trades(
&self,
fills: &[OrderFilledEvent],
) -> Vec<BacktestClosedTrade>
pub fn closed_trades( &self, fills: &[OrderFilledEvent], ) -> Vec<BacktestClosedTrade>
Reconstruct closed trades from fills.
Sourcepub fn metrics(
&self,
fills: &[OrderFilledEvent],
positions: &[Position],
) -> PerformanceMetrics
pub fn metrics( &self, fills: &[OrderFilledEvent], positions: &[Position], ) -> PerformanceMetrics
Calculate only the metrics block.
Sourcepub fn benchmark(&self, net_pnl: Decimal) -> PerformanceBenchmark
pub fn benchmark(&self, net_pnl: Decimal) -> PerformanceBenchmark
Build benchmark context for the current run.
Trait Implementations§
Source§impl Clone for PerformanceTracker
impl Clone for PerformanceTracker
Source§fn clone(&self) -> PerformanceTracker
fn clone(&self) -> PerformanceTracker
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 moreAuto Trait Implementations§
impl Freeze for PerformanceTracker
impl RefUnwindSafe for PerformanceTracker
impl Send for PerformanceTracker
impl Sync for PerformanceTracker
impl Unpin for PerformanceTracker
impl UnsafeUnpin for PerformanceTracker
impl UnwindSafe for PerformanceTracker
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