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).
Trait Implementations§
Source§impl Clone for StrikeRange
impl Clone for StrikeRange
Source§fn clone(&self) -> StrikeRange
fn clone(&self) -> StrikeRange
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StrikeRange
impl PartialEq for StrikeRange
Source§impl Serialize for StrikeRange
impl Serialize for StrikeRange
impl StructuralPartialEq for StrikeRange
Auto Trait Implementations§
impl Freeze for StrikeRange
impl RefUnwindSafe for StrikeRange
impl Send for StrikeRange
impl Sync for StrikeRange
impl Unpin for StrikeRange
impl UnsafeUnpin for StrikeRange
impl UnwindSafe for StrikeRange
Blanket Implementations§
impl<T> Allocation for T
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