pub struct ScenarioBuilder { /* private fields */ }Expand description
Builder for creating scenarios.
Implementations§
Source§impl ScenarioBuilder
impl ScenarioBuilder
Sourcepub fn with_instrument(
self,
symbol: impl Into<String>,
name: impl Into<String>,
price: Decimal,
lot_size: u32,
) -> Self
pub fn with_instrument( self, symbol: impl Into<String>, name: impl Into<String>, price: Decimal, lot_size: u32, ) -> Self
Adds an instrument.
Sourcepub fn with_position(
self,
symbol: impl Into<String>,
quantity: Decimal,
price: Decimal,
) -> Self
pub fn with_position( self, symbol: impl Into<String>, quantity: Decimal, price: Decimal, ) -> Self
Adds an initial position.
Sourcepub fn with_target(self, symbol: impl Into<String>, percent: Decimal) -> Self
pub fn with_target(self, symbol: impl Into<String>, percent: Decimal) -> Self
Sets a target allocation percentage.
Sourcepub fn with_price_model(
self,
symbol: impl Into<String>,
model: PriceModel,
) -> Self
pub fn with_price_model( self, symbol: impl Into<String>, model: PriceModel, ) -> Self
Sets the price model for an instrument.
Sourcepub const fn with_ticks(self, ticks: usize) -> Self
pub const fn with_ticks(self, ticks: usize) -> Self
Sets the number of ticks to simulate.
Sourcepub const fn with_rebalance_interval(self, interval: usize) -> Self
pub const fn with_rebalance_interval(self, interval: usize) -> Self
Sets the rebalance interval.
Sourcepub fn assert_min_value(self, value: Decimal) -> Self
pub fn assert_min_value(self, value: Decimal) -> Self
Asserts minimum portfolio value.
Sourcepub fn assert_min_return(self, percent: Decimal) -> Self
pub fn assert_min_return(self, percent: Decimal) -> Self
Asserts minimum return percentage.
Sourcepub fn assert_max_trades(self, max: usize) -> Self
pub fn assert_max_trades(self, max: usize) -> Self
Asserts maximum number of trades.
Auto Trait Implementations§
impl !RefUnwindSafe for ScenarioBuilder
impl !UnwindSafe for ScenarioBuilder
impl Forget for ScenarioBuilder
impl Freeze for ScenarioBuilder
impl Move for ScenarioBuilder
impl Send for ScenarioBuilder
impl Sync for ScenarioBuilder
impl Unpin for ScenarioBuilder
impl UnsafeUnpin for ScenarioBuilder
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