#[non_exhaustive]pub struct BacktestSettings {
pub initial_capital: f64,
pub currency: Option<String>,
pub risk_free_rate: f64,
pub order_size: OrderSize,
pub pyramiding: usize,
pub commission: Commission,
pub slippage: Slippage,
pub leverage: f64,
pub fill_on_close: bool,
pub recalculate_after_fills: bool,
pub recalculate_on_every_update: bool,
pub start_time: Option<DateTime<Utc>>,
}Expand description
Account and execution assumptions of a Backtest.
Leverage below one or non-finite counts as one. Negative or non-finite commission amounts count as zero, as in the paper account; slippage amounts follow the same rule. Invalid entry sizes are rejected.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.initial_capital: f64Starting account value in currency. Must be finite.
currency: Option<String>Currency of capital, equity and fees. Display only; no conversion is performed.
risk_free_rate: f64Annual risk-free fraction passed to the report’s performance metrics.
order_size: OrderSizeSize used by entries that do not supply their own quantity.
pyramiding: usizeMaximum simultaneously open entries in one direction. Zero disables entries.
commission: CommissionFee paid on each fill and allocated to trades by quantity.
slippage: SlippageAdverse market and stop execution adjustment.
leverage: f64Margin is absolute position market value divided by this value.
fill_on_close: boolFill market orders at the close of the bar they are placed on.
recalculate_after_fills: boolDecide again after every fill, at its execution price, without exposing future bars.
recalculate_on_every_update: boolDecide on changes of the forming bar in Backtest::update, retaining intrabar fills.
Historical Backtest::run still decides only on closed bars.
start_time: Option<DateTime<Utc>>First eligible chart-bar open. Earlier bars warm studies and strategy state without trading.
Trait Implementations§
Source§impl Clone for BacktestSettings
impl Clone for BacktestSettings
Source§fn clone(&self) -> BacktestSettings
fn clone(&self) -> BacktestSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BacktestSettings
impl Debug for BacktestSettings
Source§impl Default for BacktestSettings
impl Default for BacktestSettings
Source§impl PartialEq for BacktestSettings
impl PartialEq for BacktestSettings
impl StructuralPartialEq for BacktestSettings
Auto Trait Implementations§
impl Freeze for BacktestSettings
impl RefUnwindSafe for BacktestSettings
impl Send for BacktestSettings
impl Sync for BacktestSettings
impl Unpin for BacktestSettings
impl UnsafeUnpin for BacktestSettings
impl UnwindSafe for BacktestSettings
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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