Skip to main content

BacktestEngineConfigBuilder

Struct BacktestEngineConfigBuilder 

Source
pub struct BacktestEngineConfigBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> BacktestEngineConfigBuilder<S>

Source

pub fn build(self) -> BacktestEngineConfig
where S: IsComplete,

Finish building and return the requested object

Source

pub fn environment( self, value: Environment, ) -> BacktestEngineConfigBuilder<SetEnvironment<S>>
where S::Environment: IsUnset,

Optional (Some / Option setters). Default: Environment::Backtest.

The kernel environment context.

Source

pub fn maybe_environment( self, value: Option<Environment>, ) -> BacktestEngineConfigBuilder<SetEnvironment<S>>
where S::Environment: IsUnset,

Optional (Some / Option setters). Default: Environment::Backtest.

The kernel environment context.

Source

pub fn trader_id( self, value: TraderId, ) -> BacktestEngineConfigBuilder<SetTraderId<S>>
where S::TraderId: IsUnset,

Optional (Some / Option setters). Default: <TraderId as Default>::default().

The trader ID for the node.

Source

pub fn maybe_trader_id( self, value: Option<TraderId>, ) -> BacktestEngineConfigBuilder<SetTraderId<S>>
where S::TraderId: IsUnset,

Optional (Some / Option setters). Default: <TraderId as Default>::default().

The trader ID for the node.

Source

pub fn load_state( self, value: bool, ) -> BacktestEngineConfigBuilder<SetLoadState<S>>
where S::LoadState: IsUnset,

Optional (Some / Option setters). Default: false.

If trading strategy state should be loaded from the database on start.

Source

pub fn maybe_load_state( self, value: Option<bool>, ) -> BacktestEngineConfigBuilder<SetLoadState<S>>
where S::LoadState: IsUnset,

Optional (Some / Option setters). Default: false.

If trading strategy state should be loaded from the database on start.

Source

pub fn save_state( self, value: bool, ) -> BacktestEngineConfigBuilder<SetSaveState<S>>
where S::SaveState: IsUnset,

Optional (Some / Option setters). Default: false.

If trading strategy state should be saved to the database on stop.

Source

pub fn maybe_save_state( self, value: Option<bool>, ) -> BacktestEngineConfigBuilder<SetSaveState<S>>
where S::SaveState: IsUnset,

Optional (Some / Option setters). Default: false.

If trading strategy state should be saved to the database on stop.

Source

pub fn logging( self, value: LoggerConfig, ) -> BacktestEngineConfigBuilder<SetLogging<S>>
where S::Logging: IsUnset,

Optional (Some / Option setters). Default: <LoggerConfig as Default>::default().

The logging configuration for the kernel.

Source

pub fn maybe_logging( self, value: Option<LoggerConfig>, ) -> BacktestEngineConfigBuilder<SetLogging<S>>
where S::Logging: IsUnset,

Optional (Some / Option setters). Default: <LoggerConfig as Default>::default().

The logging configuration for the kernel.

Source

pub fn instance_id( self, value: UUID4, ) -> BacktestEngineConfigBuilder<SetInstanceId<S>>
where S::InstanceId: IsUnset,

Optional (Some / Option setters). The unique instance identifier for the kernel.

Source

pub fn maybe_instance_id( self, value: Option<UUID4>, ) -> BacktestEngineConfigBuilder<SetInstanceId<S>>
where S::InstanceId: IsUnset,

Optional (Some / Option setters). The unique instance identifier for the kernel.

Source

pub fn timeout_connection( self, value: Duration, ) -> BacktestEngineConfigBuilder<SetTimeoutConnection<S>>
where S::TimeoutConnection: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(60).

The timeout for all clients to connect and initialize.

Source

pub fn maybe_timeout_connection( self, value: Option<Duration>, ) -> BacktestEngineConfigBuilder<SetTimeoutConnection<S>>
where S::TimeoutConnection: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(60).

The timeout for all clients to connect and initialize.

Source

pub fn timeout_reconciliation( self, value: Duration, ) -> BacktestEngineConfigBuilder<SetTimeoutReconciliation<S>>
where S::TimeoutReconciliation: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(30).

The timeout for execution state to reconcile.

Source

pub fn maybe_timeout_reconciliation( self, value: Option<Duration>, ) -> BacktestEngineConfigBuilder<SetTimeoutReconciliation<S>>
where S::TimeoutReconciliation: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(30).

The timeout for execution state to reconcile.

Source

pub fn timeout_portfolio( self, value: Duration, ) -> BacktestEngineConfigBuilder<SetTimeoutPortfolio<S>>
where S::TimeoutPortfolio: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(10).

The timeout for portfolio to initialize margins and unrealized pnls.

Source

pub fn maybe_timeout_portfolio( self, value: Option<Duration>, ) -> BacktestEngineConfigBuilder<SetTimeoutPortfolio<S>>
where S::TimeoutPortfolio: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(10).

The timeout for portfolio to initialize margins and unrealized pnls.

Source

pub fn timeout_disconnection( self, value: Duration, ) -> BacktestEngineConfigBuilder<SetTimeoutDisconnection<S>>
where S::TimeoutDisconnection: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(10).

The timeout for all engine clients to disconnect.

Source

pub fn maybe_timeout_disconnection( self, value: Option<Duration>, ) -> BacktestEngineConfigBuilder<SetTimeoutDisconnection<S>>
where S::TimeoutDisconnection: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(10).

The timeout for all engine clients to disconnect.

Source

pub fn delay_post_stop( self, value: Duration, ) -> BacktestEngineConfigBuilder<SetDelayPostStop<S>>
where S::DelayPostStop: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(10).

The delay after stopping the node to await residual events before final shutdown.

Source

pub fn maybe_delay_post_stop( self, value: Option<Duration>, ) -> BacktestEngineConfigBuilder<SetDelayPostStop<S>>
where S::DelayPostStop: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(10).

The delay after stopping the node to await residual events before final shutdown.

Source

pub fn timeout_shutdown( self, value: Duration, ) -> BacktestEngineConfigBuilder<SetTimeoutShutdown<S>>
where S::TimeoutShutdown: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(5).

The timeout to await pending tasks cancellation during shutdown.

Source

pub fn maybe_timeout_shutdown( self, value: Option<Duration>, ) -> BacktestEngineConfigBuilder<SetTimeoutShutdown<S>>
where S::TimeoutShutdown: IsUnset,

Optional (Some / Option setters). Default: Duration::from_secs(5).

The timeout to await pending tasks cancellation during shutdown.

Source

pub fn cache( self, value: CacheConfig, ) -> BacktestEngineConfigBuilder<SetCache<S>>
where S::Cache: IsUnset,

Optional (Some / Option setters). The cache configuration.

crate::engine::BacktestEngine always overrides drop_instruments_on_reset to false on this config so that successive runs can reuse the same dataset.

Source

pub fn maybe_cache( self, value: Option<CacheConfig>, ) -> BacktestEngineConfigBuilder<SetCache<S>>
where S::Cache: IsUnset,

Optional (Some / Option setters). The cache configuration.

crate::engine::BacktestEngine always overrides drop_instruments_on_reset to false on this config so that successive runs can reuse the same dataset.

Source

pub fn msgbus( self, value: MessageBusConfig, ) -> BacktestEngineConfigBuilder<SetMsgbus<S>>
where S::Msgbus: IsUnset,

Optional (Some / Option setters). The message bus configuration.

Source

pub fn maybe_msgbus( self, value: Option<MessageBusConfig>, ) -> BacktestEngineConfigBuilder<SetMsgbus<S>>
where S::Msgbus: IsUnset,

Optional (Some / Option setters). The message bus configuration.

Source

pub fn data_engine( self, value: DataEngineConfig, ) -> BacktestEngineConfigBuilder<SetDataEngine<S>>
where S::DataEngine: IsUnset,

Optional (Some / Option setters). The data engine configuration.

Source

pub fn maybe_data_engine( self, value: Option<DataEngineConfig>, ) -> BacktestEngineConfigBuilder<SetDataEngine<S>>
where S::DataEngine: IsUnset,

Optional (Some / Option setters). The data engine configuration.

Source

pub fn risk_engine( self, value: RiskEngineConfig, ) -> BacktestEngineConfigBuilder<SetRiskEngine<S>>
where S::RiskEngine: IsUnset,

Optional (Some / Option setters). The risk engine configuration.

Source

pub fn maybe_risk_engine( self, value: Option<RiskEngineConfig>, ) -> BacktestEngineConfigBuilder<SetRiskEngine<S>>
where S::RiskEngine: IsUnset,

Optional (Some / Option setters). The risk engine configuration.

Source

pub fn exec_engine( self, value: ExecutionEngineConfig, ) -> BacktestEngineConfigBuilder<SetExecEngine<S>>
where S::ExecEngine: IsUnset,

Optional (Some / Option setters). The execution engine configuration.

Source

pub fn maybe_exec_engine( self, value: Option<ExecutionEngineConfig>, ) -> BacktestEngineConfigBuilder<SetExecEngine<S>>
where S::ExecEngine: IsUnset,

Optional (Some / Option setters). The execution engine configuration.

Source

pub fn portfolio( self, value: PortfolioConfig, ) -> BacktestEngineConfigBuilder<SetPortfolio<S>>
where S::Portfolio: IsUnset,

Optional (Some / Option setters). The portfolio configuration.

Source

pub fn maybe_portfolio( self, value: Option<PortfolioConfig>, ) -> BacktestEngineConfigBuilder<SetPortfolio<S>>
where S::Portfolio: IsUnset,

Optional (Some / Option setters). The portfolio configuration.

Source

pub fn streaming( self, value: StreamingConfig, ) -> BacktestEngineConfigBuilder<SetStreaming<S>>
where S::Streaming: IsUnset,

Optional (Some / Option setters). The configuration for streaming to feather files.

Source

pub fn maybe_streaming( self, value: Option<StreamingConfig>, ) -> BacktestEngineConfigBuilder<SetStreaming<S>>
where S::Streaming: IsUnset,

Optional (Some / Option setters). The configuration for streaming to feather files.

Source

pub fn bypass_logging( self, value: bool, ) -> BacktestEngineConfigBuilder<SetBypassLogging<S>>
where S::BypassLogging: IsUnset,

Optional (Some / Option setters). Default: false.

If logging should be bypassed.

Source

pub fn maybe_bypass_logging( self, value: Option<bool>, ) -> BacktestEngineConfigBuilder<SetBypassLogging<S>>
where S::BypassLogging: IsUnset,

Optional (Some / Option setters). Default: false.

If logging should be bypassed.

Source

pub fn run_analysis( self, value: bool, ) -> BacktestEngineConfigBuilder<SetRunAnalysis<S>>
where S::RunAnalysis: IsUnset,

Optional (Some / Option setters). Default: true.

If post backtest performance analysis should be run.

Source

pub fn maybe_run_analysis( self, value: Option<bool>, ) -> BacktestEngineConfigBuilder<SetRunAnalysis<S>>
where S::RunAnalysis: IsUnset,

Optional (Some / Option setters). Default: true.

If post backtest performance analysis should be run.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> Ungil for T
where T: Send,