pub struct PriceAlertRegister { /* private fields */ }Expand description
BTreeMap-indexed price alert register for O(log N + K) rule evaluation.
Static rules (SL, TP, breakeven, pending fills) are stored as sorted price alerts. Stateful rules (trailing stop, time exit) are tracked in a separate set for tick-by-tick evaluation on only those positions.
Implementations§
Source§impl PriceAlertRegister
impl PriceAlertRegister
Sourcepub fn register(
&mut self,
symbol: &str,
price: f64,
position_id: PositionId,
side: Side,
kind: AlertKind,
)
pub fn register( &mut self, symbol: &str, price: f64, position_id: PositionId, side: Side, kind: AlertKind, )
Register a price alert for a position.
Sourcepub fn register_tick_eval(&mut self, symbol: &str, position_id: PositionId)
pub fn register_tick_eval(&mut self, symbol: &str, position_id: PositionId)
Register a position for tick-by-tick evaluation (has stateful rules).
Sourcepub fn unregister_tick_eval(&mut self, symbol: &str, position_id: &str)
pub fn unregister_tick_eval(&mut self, symbol: &str, position_id: &str)
Unregister a position from tick-by-tick evaluation.
Sourcepub fn deregister_position(&mut self, position_id: &str)
pub fn deregister_position(&mut self, position_id: &str)
Remove all alerts for a specific position.
Sourcepub fn deregister_alert(
&mut self,
symbol: &str,
price: f64,
position_id: &str,
side: Side,
kind: &AlertKind,
)
pub fn deregister_alert( &mut self, symbol: &str, price: f64, position_id: &str, side: Side, kind: &AlertKind, )
Remove a specific alert for a position at a given price and kind.
Sourcepub fn check(
&mut self,
quote: &PriceQuote,
model: FillModel,
) -> Vec<TriggeredAlert>
pub fn check( &mut self, quote: &PriceQuote, model: FillModel, ) -> Vec<TriggeredAlert>
Check all alerts for a symbol against the current quote. Returns triggered alerts and removes them from the register.
Sourcepub fn tick_eval_ids(&self, symbol: &str) -> Vec<PositionId> ⓘ
pub fn tick_eval_ids(&self, symbol: &str) -> Vec<PositionId> ⓘ
Get position IDs that need tick-by-tick evaluation for a symbol.
Sourcepub fn has_alerts(&self, position_id: &str) -> bool
pub fn has_alerts(&self, position_id: &str) -> bool
Check if a position has any registered alerts.
Sourcepub fn is_tick_eval(&self, symbol: &str, position_id: &str) -> bool
pub fn is_tick_eval(&self, symbol: &str, position_id: &str) -> bool
Check if a position is registered for tick evaluation.
Sourcepub fn alert_count(&self) -> usize
pub fn alert_count(&self) -> usize
Total number of alert entries across both directional maps.
Sourcepub fn position_count(&self) -> usize
pub fn position_count(&self) -> usize
Number of positions with registered alerts.
Trait Implementations§
Source§impl Clone for PriceAlertRegister
impl Clone for PriceAlertRegister
Source§fn clone(&self) -> PriceAlertRegister
fn clone(&self) -> PriceAlertRegister
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more