pub struct Options { /* private fields */ }Expand description
Response wrapper for options endpoint
Note: While this type is public for return values, users should not manually construct it.
Use Ticker::options() to obtain options data.
Implementations§
Source§impl Options
impl Options
Sourcepub fn expiration_dates(&self) -> Vec<i64>
pub fn expiration_dates(&self) -> Vec<i64>
Get available expiration dates
Sourcepub fn calls(&self) -> Contracts
pub fn calls(&self) -> Contracts
Get all call contracts flattened across all expirations.
Returns a Contracts wrapper that supports .to_dataframe() when
the dataframe feature is enabled.
§Example
let options = ticker.options(None).await?;
for call in &options.calls {
println!("{}: strike={}", call.contract_symbol, call.strike);
}
// With dataframe feature:
let df = options.calls.to_dataframe()?;Sourcepub fn puts(&self) -> Contracts
pub fn puts(&self) -> Contracts
Get all put contracts flattened across all expirations.
Returns a Contracts wrapper that supports .to_dataframe() when
the dataframe feature is enabled.
§Example
let options = ticker.options(None).await?;
for put in &options.puts {
println!("{}: strike={}", put.contract_symbol, put.strike);
}
// With dataframe feature:
let df = options.puts.to_dataframe()?;Source§impl Options
impl Options
Sourcepub fn to_dataframe(&self) -> PolarsResult<DataFrame>
pub fn to_dataframe(&self) -> PolarsResult<DataFrame>
Converts all option contracts (calls and puts) to a polars DataFrame.
Flattens all contracts across all expiration dates into a single DataFrame
with an additional option_type column (“call” or “put”).
For separate DataFrames, use options.calls.to_dataframe() or
options.puts.to_dataframe().
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Options
impl<'de> Deserialize<'de> for Options
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>,
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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