pub struct PositionState {
pub first_seen: Instant,
pub last_seen: Instant,
pub samples: u64,
pub peak_pnl_ratio: f64,
pub last_action: GuidanceAction,
}Expand description
Rolling per-position state, accumulated across the repeated snapshots a
producer pushes for the same position_id. Lets guidance depend on a
position’s history (peak profit, prior advice) rather than scoring each
snapshot in isolation.
Fields§
§first_seen: InstantInstant the first snapshot for this position arrived.
last_seen: InstantInstant the most recent snapshot arrived (drives TTL eviction).
samples: u64Number of snapshots observed for this position.
peak_pnl_ratio: f64Highest unrealized-P&L ratio (pnl / notional) seen so far.
last_action: GuidanceActionMost recent guidance action issued for this position.
Implementations§
Source§impl PositionState
impl PositionState
Sourcepub fn time_in_position(&self) -> Duration
pub fn time_in_position(&self) -> Duration
How long this position has been reported.
Trait Implementations§
Source§impl Clone for PositionState
impl Clone for PositionState
Source§fn clone(&self) -> PositionState
fn clone(&self) -> PositionState
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 moreAuto Trait Implementations§
impl Freeze for PositionState
impl RefUnwindSafe for PositionState
impl Send for PositionState
impl Sync for PositionState
impl Unpin for PositionState
impl UnsafeUnpin for PositionState
impl UnwindSafe for PositionState
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