pub struct BacktestRecorder { /* private fields */ }
Available on crate feature
backtest
only.Expand description
Provides recording of the backtesting strategy’s state values, which are needed to compute performance metrics.
Implementations§
Source§impl BacktestRecorder
impl BacktestRecorder
Sourcepub fn new<I, MD>(hbt: &I) -> Selfwhere
MD: MarketDepth,
I: Bot<MD>,
pub fn new<I, MD>(hbt: &I) -> Selfwhere
MD: MarketDepth,
I: Bot<MD>,
Constructs an instance of BacktestRecorder
.
Sourcepub fn to_csv<Prefix, P>(&self, prefix: Prefix, path: P) -> Result<(), Error>
pub fn to_csv<Prefix, P>(&self, prefix: Prefix, path: P) -> Result<(), Error>
Saves record data into a CSV file at the specified path. It creates a separate CSV file for
each asset, with the filename {prefix}_{asset_no}.csv
.
The columns are timestamp
, mid
, balance
, position
, fee
, trade_num
,
trade_amount
, trade_qty
.
pub fn to_npz<P>(&self, path: P) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BacktestRecorder
impl RefUnwindSafe for BacktestRecorder
impl Send for BacktestRecorder
impl Sync for BacktestRecorder
impl Unpin for BacktestRecorder
impl UnwindSafe for BacktestRecorder
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