pub struct OptionInstrumentPair {
pub call: Option<OptionInstrument>,
pub put: Option<OptionInstrument>,
}Expand description
A pair of option instruments representing both call and put options for the same underlying asset
This structure groups together the call and put options for a specific underlying asset, allowing for easy access to both sides of an option strategy. Both options are optional, meaning you can have just a call, just a put, or both.
Fields§
§call: Option<OptionInstrument>Call option instrument data, if available
put: Option<OptionInstrument>Put option instrument data, if available
Implementations§
Source§impl OptionInstrumentPair
impl OptionInstrumentPair
Sourcepub fn expiration(&self) -> Option<DateTime<Utc>>
pub fn expiration(&self) -> Option<DateTime<Utc>>
Returns the expiration date/time of the option instrument.
Extracts the expiration timestamp from the call or put instrument and converts it to a UTC datetime.
Sourcepub fn instrument(&self) -> Option<Instrument>
pub fn instrument(&self) -> Option<Instrument>
Returns the first available instrument from call or put option.
Prefers the call instrument if available, otherwise returns the put.
Sourcepub fn ticker(&self) -> Option<TickerData>
pub fn ticker(&self) -> Option<TickerData>
Returns the first available ticker data from call or put option.
Prefers the call ticker if available, otherwise returns the put.
Sourcepub fn open_interest(&self) -> f64
pub fn open_interest(&self) -> f64
Calculates total open interest across both call and put options.
Sourcepub fn interest_rate(&self) -> f64
pub fn interest_rate(&self) -> f64
Calculates total interest rate across both call and put options.
Sourcepub fn call_spread(&self) -> Spread
pub fn call_spread(&self) -> Spread
Calculates bid-ask spread for the call option.
Returns bid, ask, and mid prices. Mid is the average of bid and ask.
Sourcepub fn put_spread(&self) -> Spread
pub fn put_spread(&self) -> Spread
Calculates bid-ask spread for the put option.
Returns bid, ask, and mid prices. Mid is the average of bid and ask.
Sourcepub fn iv(&self) -> (Option<f64>, Option<f64>)
pub fn iv(&self) -> (Option<f64>, Option<f64>)
Returns implied volatility for both call and put options.
Returns a tuple of (call_iv, put_iv).
Sourcepub fn greeks(&self) -> BasicGreeks
pub fn greeks(&self) -> BasicGreeks
Calculates basic Greeks (delta, gamma) for both call and put options.
Sourcepub fn data(&self) -> BasicOptionData
pub fn data(&self) -> BasicOptionData
Extracts and consolidates all option data into a structured format.
Includes strike price, spreads, implied volatility, and Greeks.
Trait Implementations§
Source§impl Clone for OptionInstrumentPair
impl Clone for OptionInstrumentPair
Source§fn clone(&self) -> OptionInstrumentPair
fn clone(&self) -> OptionInstrumentPair
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more