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.
§Errors
Returns an error if engine creation, venue setup, or instrument loading fails.
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.
§Errors
Returns an error if building, data loading, or engine execution fails.
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§
Source§impl Debug for BacktestNode
impl Debug for BacktestNode
Source§impl<'py> IntoPyObject<'py> for BacktestNode
impl<'py> IntoPyObject<'py> for BacktestNode
Source§type Target = BacktestNode
type Target = BacktestNode
Source§type Output = Bound<'py, <BacktestNode as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <BacktestNode as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for BacktestNode
impl PyClass for BacktestNode
Source§impl PyClassImpl for BacktestNode
impl PyClassImpl for BacktestNode
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// 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.
const RAW_DOC: &'static CStr = /// 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.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<BacktestNode as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<BacktestNode>
type Layout = <<BacktestNode as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<BacktestNode>
Source§type ThreadChecker = ThreadCheckerImpl
type ThreadChecker = ThreadCheckerImpl
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for BacktestNode
impl PyClassNewTextSignature for BacktestNode
const TEXT_SIGNATURE: &'static str = "(configs)"
Source§impl PyMethods<BacktestNode> for PyClassImplCollector<BacktestNode>
impl PyMethods<BacktestNode> for PyClassImplCollector<BacktestNode>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for BacktestNode
impl PyTypeInfo for BacktestNode
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
::type_object(py).name() to get the correct runtime valueSource§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
::type_object(py).module() to get the correct runtime valueSource§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for BacktestNode
impl ExtractPyClassWithClone for BacktestNode
Auto Trait Implementations§
impl Freeze for BacktestNode
impl !RefUnwindSafe for BacktestNode
impl !Send for BacktestNode
impl !Sync for BacktestNode
impl Unpin for BacktestNode
impl UnsafeUnpin for BacktestNode
impl !UnwindSafe 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
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 moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.