pub enum StrikeRange {
Fixed(Vec<Price>),
AtmRelative {
strikes_above: usize,
strikes_below: usize,
},
AtmPercent {
pct: 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.
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.
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
Returns a duplicate of the value. Read more
1.0.0 · 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 PartialEq for StrikeRange
impl PartialEq 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§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more