pub struct PortfolioEngine { /* private fields */ }Expand description
Multi-symbol portfolio backtesting engine.
Runs all symbols on a shared capital pool, applying the configured allocation strategy and position constraints simultaneously.
Implementations§
Source§impl PortfolioEngine
impl PortfolioEngine
Sourcepub fn new(config: PortfolioConfig) -> Self
pub fn new(config: PortfolioConfig) -> Self
Create a new portfolio engine.
Sourcepub fn run<S, F>(
&self,
symbol_data: &[SymbolData],
factory: F,
) -> Result<PortfolioResult>
pub fn run<S, F>( &self, symbol_data: &[SymbolData], factory: F, ) -> Result<PortfolioResult>
Run a portfolio backtest.
factory is called once per symbol to create an independent strategy
instance for that symbol. Use a closure that captures any shared
parameters:
ⓘ
engine.run(&symbol_data, |sym| SmaCrossover::new(10, 50))Entry signals across symbols are ranked by strength (descending); ties broken alphabetically, giving deterministic results.
Auto Trait Implementations§
impl Freeze for PortfolioEngine
impl !RefUnwindSafe for PortfolioEngine
impl Send for PortfolioEngine
impl Sync for PortfolioEngine
impl Unpin for PortfolioEngine
impl UnsafeUnpin for PortfolioEngine
impl !UnwindSafe for PortfolioEngine
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
Converts
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> ⓘ
Converts
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