#[non_exhaustive]pub struct OptionExposure {
pub kind: OptionExposureKind,
pub time: DateTime<Utc>,
pub unit: String,
pub model: Option<String>,
pub rows: Vec<OptionExposureRow>,
pub missing_contracts: usize,
}Expand description
A complete exposure observation, supplied by a feed or computed from an option chain.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: OptionExposureKindSensitivity represented by these values.
time: DateTime<Utc>UTC observation time. Computed gamma uses the newest input observation.
unit: StringDisplay units, supplied by the feed or documented by Self::gamma.
model: Option<String>Optional name of the feed’s valuation or position model.
rows: Vec<OptionExposureRow>Exposure by expiry and strike; supplied rows keep their order and figures.
missing_contracts: usizeContracts omitted because an input was unknown. Zero open interest is not missing.
Implementations§
Source§impl OptionExposure
impl OptionExposure
Sourcepub fn new(
kind: OptionExposureKind,
time: DateTime<Utc>,
unit: impl Into<String>,
rows: Vec<OptionExposureRow>,
) -> Self
pub fn new( kind: OptionExposureKind, time: DateTime<Utc>, unit: impl Into<String>, rows: Vec<OptionExposureRow>, ) -> Self
An observation with no model label or missing contracts.
Sourcepub fn gamma<'a>(
quotes: impl IntoIterator<Item = &'a OptionQuote>,
) -> Result<Option<Self>, FeedError>
pub fn gamma<'a>( quotes: impl IntoIterator<Item = &'a OptionQuote>, ) -> Result<Option<Self>, FeedError>
Compute gamma * open_interest * multiplier * underlying_price² * 0.01 per contract,
in the underlying’s price currency per 1% underlying move. Calls use a positive sign
and puts a negative sign: this is a convention, not an inference about positions.
The quotes must belong to one underlying and currency, with unscaled contract Greeks.
Missing inputs omit and count the contract; zero open interest contributes Some(0).
Rows sort by expiry then strike, summing each side and taking their sum as net.
A side with no usable contracts stays None. Returns Ok(None) without observations,
or FeedError::InvalidData for invalid inputs or arithmetic overflow.
Trait Implementations§
Source§impl Clone for OptionExposure
impl Clone for OptionExposure
Source§fn clone(&self) -> OptionExposure
fn clone(&self) -> OptionExposure
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 OptionExposure
impl Debug for OptionExposure
Source§impl PartialEq for OptionExposure
impl PartialEq for OptionExposure
impl StructuralPartialEq for OptionExposure
Auto Trait Implementations§
impl Freeze for OptionExposure
impl RefUnwindSafe for OptionExposure
impl Send for OptionExposure
impl Sync for OptionExposure
impl Unpin for OptionExposure
impl UnsafeUnpin for OptionExposure
impl UnwindSafe for OptionExposure
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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