#[non_exhaustive]pub struct SizingContext {
pub atr: Option<f64>,
pub recent_volatility: Option<f64>,
pub win_rate: Option<f64>,
pub payoff_ratio: Option<f64>,
}Expand description
Market and trade-history inputs a PositionSizing scheme reads at entry.
A None field means the engine had no value to supply, and the scheme falls
back to BacktestConfig::position_size_pct.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.atr: Option<f64>ATR at the entry bar.
recent_volatility: Option<f64>Realized per-bar return volatility over the scheme’s lookback.
win_rate: Option<f64>Win rate over the trailing closed-trade window (0.0 - 1.0).
payoff_ratio: Option<f64>Mean win divided by mean loss, both as absolute return fractions.
Trait Implementations§
Source§impl Clone for SizingContext
impl Clone for SizingContext
Source§fn clone(&self) -> SizingContext
fn clone(&self) -> SizingContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SizingContext
Source§impl Debug for SizingContext
impl Debug for SizingContext
Source§impl Default for SizingContext
impl Default for SizingContext
Source§fn default() -> SizingContext
fn default() -> SizingContext
Returns the “default value” for a type. Read more
Source§impl PartialEq for SizingContext
impl PartialEq for SizingContext
impl StructuralPartialEq for SizingContext
Auto Trait Implementations§
impl Freeze for SizingContext
impl RefUnwindSafe for SizingContext
impl Send for SizingContext
impl Sync for SizingContext
impl Unpin for SizingContext
impl UnsafeUnpin for SizingContext
impl UnwindSafe for SizingContext
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
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> 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