pub struct ManagedPosition {
pub perp_id: [u8; 32],
pub position_id: u64,
pub is_long: bool,
pub entry_price: f64,
pub margin: f64,
pub stop_loss: Option<f64>,
pub take_profit: Option<f64>,
pub trailing_stop_pct: Option<f64>,
pub trailing_stop_anchor: Option<f64>,
}Expand description
A position being tracked for automated trigger evaluation.
Fields§
§perp_id: [u8; 32]Perp market identifier.
position_id: u64Position NFT ID.
is_long: booltrue = long, false = short.
entry_price: f64Entry price in USDC.
margin: f64Margin deposited in USDC.
stop_loss: Option<f64>Stop-loss price. None = disabled.
take_profit: Option<f64>Take-profit price. None = disabled.
trailing_stop_pct: Option<f64>Trailing stop percentage (e.g. 0.02 = 2%). None = disabled.
trailing_stop_anchor: Option<f64>High-water mark (longs) or low-water mark (shorts) for trailing stop.
Updated automatically by check_triggers.
Set to None initially; the first price observation will seed it.
Trait Implementations§
Source§impl Clone for ManagedPosition
impl Clone for ManagedPosition
Source§fn clone(&self) -> ManagedPosition
fn clone(&self) -> ManagedPosition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ManagedPosition
impl Debug for ManagedPosition
Source§impl PartialEq for ManagedPosition
impl PartialEq for ManagedPosition
impl Copy for ManagedPosition
impl StructuralPartialEq for ManagedPosition
Auto Trait Implementations§
impl Freeze for ManagedPosition
impl RefUnwindSafe for ManagedPosition
impl Send for ManagedPosition
impl Sync for ManagedPosition
impl Unpin for ManagedPosition
impl UnsafeUnpin for ManagedPosition
impl UnwindSafe for ManagedPosition
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
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