pub struct BacktestNode { /* private fields */ }Expand description
Orchestrates catalog-driven backtests from run configurations.
BacktestNode connects the ParquetDataCatalog with BacktestEngine to load
historical data and run backtests. Supports both oneshot and streaming modes.
Implementations§
Source§impl BacktestNode
impl BacktestNode
Sourcepub fn new(configs: Vec<BacktestRunConfig>) -> Result<Self>
pub fn new(configs: Vec<BacktestRunConfig>) -> Result<Self>
Creates a new BacktestNode instance.
Validates that configs are non-empty and internally consistent:
- All data config instrument venues must have a matching venue config.
- L2/L3 book types require order book data in the data configs.
- Data config time ranges must be valid (start <= end).
§Errors
Returns an error if configs is empty or validation fails.
Sourcepub fn configs(&self) -> &[BacktestRunConfig]
pub fn configs(&self) -> &[BacktestRunConfig]
Returns the run configurations.
Sourcepub fn build(&mut self) -> Result<()>
pub fn build(&mut self) -> Result<()>
Builds backtest engines from the run configurations.
For each config, creates a BacktestEngine, adds venues, and loads
instruments from the catalog. If building a config fails with
BacktestRunConfig::raise_exception disabled, logs the error and skips that config;
successful return does not guarantee an engine for every config.
§Errors
Returns an error if building an engine from a config fails and
BacktestRunConfig::raise_exception is enabled for that config.
Sourcepub fn get_engine_mut(&mut self, id: &str) -> Option<&mut BacktestEngine>
pub fn get_engine_mut(&mut self, id: &str) -> Option<&mut BacktestEngine>
Returns a mutable reference to the engine for the given run config ID.
Sourcepub fn get_engine(&self, id: &str) -> Option<&BacktestEngine>
pub fn get_engine(&self, id: &str) -> Option<&BacktestEngine>
Returns a reference to the engine for the given run config ID.
Sourcepub fn get_engines(&self) -> Vec<&BacktestEngine>
pub fn get_engines(&self) -> Vec<&BacktestEngine>
Returns all created backtest engines.
Sourcepub fn run(&mut self) -> Result<Vec<BacktestResult>>
pub fn run(&mut self) -> Result<Vec<BacktestResult>>
Runs all configured backtests and returns results.
Automatically calls build() if engines have not been created yet.
For each run config, loads data from the catalog and runs the engine.
Supports both oneshot (chunk_size = None) and streaming modes.
Configs without a built engine are skipped. If a run fails with
BacktestRunConfig::raise_exception disabled, logs the error, clears its loaded data,
leaves the engine undisposed, and omits its result.
§Errors
Returns an error if building, data loading, or engine execution fails and
BacktestRunConfig::raise_exception is enabled for the run config.
Sourcepub fn load_catalog(config: &BacktestDataConfig) -> Result<ParquetDataCatalog>
pub fn load_catalog(config: &BacktestDataConfig) -> Result<ParquetDataCatalog>
Creates a ParquetDataCatalog from a data config.
§Errors
Returns an error if the catalog cannot be created from the URI.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BacktestNode
impl !Send for BacktestNode
impl !Sync for BacktestNode
impl !UnwindSafe for BacktestNode
impl Freeze for BacktestNode
impl Unpin for BacktestNode
impl UnsafeUnpin for BacktestNode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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