Skip to main content

PriceAlertRegister

Struct PriceAlertRegister 

Source
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

Source

pub fn new() -> Self

Create an empty alert register.

Source

pub fn register( &mut self, symbol: &str, price: f64, position_id: PositionId, side: Side, kind: AlertKind, )

Register a price alert for a position.

Source

pub fn register_tick_eval(&mut self, symbol: &str, position_id: PositionId)

Register a position for tick-by-tick evaluation (has stateful rules).

Source

pub fn unregister_tick_eval(&mut self, symbol: &str, position_id: &str)

Unregister a position from tick-by-tick evaluation.

Source

pub fn deregister_position(&mut self, position_id: &str)

Remove all alerts for a specific position.

Source

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.

Source

pub fn clear_all(&mut self)

Remove all alerts across all positions.

Source

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.

Source

pub fn tick_eval_ids(&self, symbol: &str) -> Vec<PositionId> ⓘ

Get position IDs that need tick-by-tick evaluation for a symbol.

Source

pub fn has_alerts(&self, position_id: &str) -> bool

Check if a position has any registered alerts.

Source

pub fn is_tick_eval(&self, symbol: &str, position_id: &str) -> bool

Check if a position is registered for tick evaluation.

Source

pub fn alert_count(&self) -> usize

Total number of alert entries across both directional maps.

Source

pub fn position_count(&self) -> usize

Number of positions with registered alerts.

Trait Implementations§

Source§

impl Clone for PriceAlertRegister

Source§

fn clone(&self) -> PriceAlertRegister

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PriceAlertRegister

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PriceAlertRegister

Source§

fn default() -> PriceAlertRegister

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V