pub struct Signal {Show 13 fields
pub id: String,
pub symbol: String,
pub signal_type: SignalType,
pub confidence: f64,
pub timestamp: DateTime<Utc>,
pub priority: SignalPriority,
pub source: String,
pub strategy_id: Option<String>,
pub target_price: Option<f64>,
pub stop_loss: Option<f64>,
pub take_profit: Option<f64>,
pub quantity: Option<f64>,
pub metadata: HashMap<String, String>,
}Expand description
Trading signal shared across all modules
Fields§
§id: StringUnique signal ID
symbol: StringTrading symbol (e.g., BTCUSD)
signal_type: SignalTypeSignal type (buy, sell, hold, close)
confidence: f64Confidence score (0.0 to 1.0)
timestamp: DateTime<Utc>Signal timestamp
priority: SignalPrioritySignal priority
source: StringSource module that generated the signal
strategy_id: Option<String>Strategy ID that generated this signal
target_price: Option<f64>Target price (optional)
stop_loss: Option<f64>Stop loss price (optional)
take_profit: Option<f64>Take profit price (optional)
quantity: Option<f64>Position size (optional)
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl Signal
impl Signal
Sourcepub fn new(
symbol: impl Into<String>,
signal_type: SignalType,
confidence: f64,
) -> Self
pub fn new( symbol: impl Into<String>, signal_type: SignalType, confidence: f64, ) -> Self
Create a new signal
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Builder pattern methods
pub fn with_priority(self, priority: SignalPriority) -> Self
pub fn with_strategy(self, strategy_id: impl Into<String>) -> Self
pub fn with_target_price(self, price: f64) -> Self
pub fn with_stop_loss(self, price: f64) -> Self
pub fn with_take_profit(self, price: f64) -> Self
pub fn with_quantity(self, quantity: f64) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Sourcepub fn is_actionable(&self) -> bool
pub fn is_actionable(&self) -> bool
Check if signal is actionable (not a hold)
Sourcepub fn meets_threshold(&self, threshold: f64) -> bool
pub fn meets_threshold(&self, threshold: f64) -> bool
Check if signal meets confidence threshold
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 UnsafeUnpin 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