pub struct MaxConsecutiveLossRule {
pub max_consecutive: usize,
/* private fields */
}Expand description
Triggers a breach when equity has declined for max_consecutive consecutive updates.
Each call to RiskMonitor::update where equity is lower than the previous
update counts as a loss. When the streak reaches max_consecutive, a breach
is returned for every subsequent declining update until the streak resets.
Because this rule must track state across calls, it holds a mutable counter
internally using std::cell::Cell.
Fields§
§max_consecutive: usizeMaximum number of consecutive declining equity updates before breach.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MaxConsecutiveLossRule
impl !RefUnwindSafe for MaxConsecutiveLossRule
impl Send for MaxConsecutiveLossRule
impl !Sync for MaxConsecutiveLossRule
impl Unpin for MaxConsecutiveLossRule
impl UnsafeUnpin for MaxConsecutiveLossRule
impl UnwindSafe for MaxConsecutiveLossRule
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