pub struct Signal {
pub id: Uuid,
pub symbol: Symbol,
pub kind: SignalKind,
pub confidence: f64,
pub quantity: Option<Quantity>,
pub group_id: Option<Uuid>,
pub panic_behavior: Option<SignalPanicBehavior>,
pub generated_at: DateTime<Utc>,
pub note: Option<String>,
pub stop_loss: Option<Price>,
pub take_profit: Option<Price>,
pub execution_hint: Option<ExecutionHint>,
}Expand description
High-level intent generated by strategies.
Fields§
§id: Uuid§symbol: Symbol§kind: SignalKind§confidence: f64§quantity: Option<Quantity>§group_id: Option<Uuid>§panic_behavior: Option<SignalPanicBehavior>§generated_at: DateTime<Utc>§note: Option<String>§stop_loss: Option<Price>§take_profit: Option<Price>§execution_hint: Option<ExecutionHint>Implementations§
Source§impl Signal
impl Signal
Sourcepub fn new(symbol: impl Into<Symbol>, kind: SignalKind, confidence: f64) -> Self
pub fn new(symbol: impl Into<Symbol>, kind: SignalKind, confidence: f64) -> Self
Convenience constructor to build a signal with a random identifier.
Sourcepub fn with_hint(self, hint: ExecutionHint) -> Self
pub fn with_hint(self, hint: ExecutionHint) -> Self
Add an execution hint to the signal.
Sourcepub fn with_quantity(self, quantity: Quantity) -> Self
pub fn with_quantity(self, quantity: Quantity) -> Self
Override the default sizing logic with a fixed quantity.
Sourcepub fn with_group(self, group_id: Uuid) -> Self
pub fn with_group(self, group_id: Uuid) -> Self
Associate this signal with a multi-leg execution group.
Sourcepub fn with_panic_behavior(self, behavior: SignalPanicBehavior) -> Self
pub fn with_panic_behavior(self, behavior: SignalPanicBehavior) -> Self
Override the default panic close behavior for this signal’s execution group.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signal
impl<'de> Deserialize<'de> for Signal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Signal
impl RefUnwindSafe for Signal
impl Send for Signal
impl Sync for Signal
impl Unpin for Signal
impl UnwindSafe for Signal
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