pub enum StrikeRange {
Fixed(Vec<Price>),
AtmRelative {
strikes_above: usize,
strikes_below: usize,
},
AtmPercent {
pct: f64,
},
Delta {
target: f64,
tolerance: f64,
},
}Expand description
Defines which strikes to include in an option chain subscription.
Variants§
Fixed(Vec<Price>)
Subscribe to a fixed set of strike prices.
AtmRelative
Subscribe to strikes relative to ATM: N strikes above and N below.
AtmPercent
Subscribe to strikes within a percentage band around ATM price.
Delta
Subscribe to strikes whose absolute option delta is near target.
Delta resolution needs Greeks, so the option chain aggregator performs it.
The model-level StrikeRange::resolve has no Greeks and falls back to an
ATM-relative window of DEFAULT_DELTA_FALLBACK_STRIKES strikes either side
of ATM until Greeks are available.
Implementations§
Source§impl StrikeRange
impl StrikeRange
Sourcepub fn resolve(
&self,
atm_price: Option<Price>,
all_strikes: &[Price],
) -> Vec<Price>
pub fn resolve( &self, atm_price: Option<Price>, all_strikes: &[Price], ) -> Vec<Price>
Resolves the filtered set of strikes from all available strikes.
Fixed: returns the fixed strikes directly (intersected with available).AtmRelative: finds the closest strike to ATM, takes N above and N below.AtmPercent: filters strikes within a percentage band around ATM.Delta: has no Greeks at this level, so it falls back to an ATM-relative window ofDEFAULT_DELTA_FALLBACK_STRIKESstrikes either side of ATM. The option chain aggregator resolvesDeltafrom Greeks instead.
If atm_price is None for ATM-based variants, returns an empty vec
(subscriptions are deferred until ATM is known).
§Panics
Panics if a strike price comparison returns None (i.e. a NaN price value).
Trait Implementations§
Source§impl Clone for StrikeRange
impl Clone for StrikeRange
Source§fn clone(&self) -> StrikeRange
fn clone(&self) -> StrikeRange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StrikeRange
impl Debug for StrikeRange
Source§impl<'de> Deserialize<'de> for StrikeRange
impl<'de> Deserialize<'de> for StrikeRange
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>,
Source§impl PartialEq for StrikeRange
impl PartialEq for StrikeRange
Source§fn eq(&self, other: &StrikeRange) -> bool
fn eq(&self, other: &StrikeRange) -> bool
self and other values to be equal, and is used by ==.