pub trait AlertExt:
Stream<Item = PriceUpdate>
+ Sized
+ Unpin {
// Provided method
fn alerts(
self,
rules: impl IntoIterator<Item = AlertRule>,
) -> AlertStream<Self> { ... }
}Expand description
Adds alerts to every price stream.
§Example
use finance_query::streaming::{AlertCondition, AlertExt, AlertRule, PriceStream};
use futures::StreamExt;
let mut alerts = PriceStream::subscribe(["AAPL"])
.await?
.alerts([AlertRule::new("AAPL", AlertCondition::CrossesAbove(200.0))]);
while let Some(alert) = alerts.next().await {
println!("{} crossed at {}", alert.symbol, alert.price);
}Provided Methods§
Sourcefn alerts(self, rules: impl IntoIterator<Item = AlertRule>) -> AlertStream<Self>
fn alerts(self, rules: impl IntoIterator<Item = AlertRule>) -> AlertStream<Self>
Yield only the ticks that trigger one of rules.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".