pub struct OptionDataPriceParams { /* private fields */ }
Expand description
Parameters required for pricing an option contract.
This structure encapsulates all necessary inputs for option pricing models such as Black-Scholes or binomial tree models. It contains information about the underlying asset, market conditions, and contract specifications needed to calculate fair option values.
§Fields
-
underlying_price
- The current market price of the underlying asset. -
expiration_date
- When the option contract expires, either as days to expiration or as a specific datetime. -
implied_volatility
- The expected volatility of the underlying asset price over the life of the option. If None, it may be calculated from other parameters. -
risk_free_rate
- The theoretical rate of return of an investment with zero risk, used in option pricing models. -
dividend_yield
- The dividend yield of the underlying asset, expressed as a positive decimal value. -
underlying_symbol
- Optional ticker or identifier for the underlying asset.
§Usage
This structure is typically used as input to option pricing functions to calculate theoretical values, Greeks (delta, gamma, etc.), and other option metrics.
Implementations§
Source§impl OptionDataPriceParams
impl OptionDataPriceParams
Sourcepub fn new(
underlying_price: Option<Box<Positive>>,
expiration_date: Option<ExpirationDate>,
risk_free_rate: Option<Decimal>,
dividend_yield: Option<Positive>,
underlying_symbol: Option<String>,
) -> Self
pub fn new( underlying_price: Option<Box<Positive>>, expiration_date: Option<ExpirationDate>, risk_free_rate: Option<Decimal>, dividend_yield: Option<Positive>, underlying_symbol: Option<String>, ) -> Self
Creates a new instance of OptionDataPriceParams
with the provided parameters.
This constructor initializes all the required fields for option pricing calculations, including asset price, expiration, volatility, and market rates.
§Parameters
underlying_price
- The current market price of the underlying assetexpiration_date
- When the option contract expires (either as days to expiration or as a specific datetime)implied_volatility
- The expected volatility of the underlying asset price (if known)risk_free_rate
- The theoretical risk-free interest rate used in pricing calculationsdividend_yield
- The dividend yield of the underlying assetunderlying_symbol
- Optional ticker or identifier for the underlying asset
§Returns
A new instance of OptionDataPriceParams
containing the provided parameters
Sourcepub fn get_underlying_price(&self) -> Option<Box<Positive>>
pub fn get_underlying_price(&self) -> Option<Box<Positive>>
Returns the current price of the underlying asset.
§Returns
A Positive
value representing the underlying asset’s current market price
Sourcepub fn get_expiration_date(&self) -> Option<ExpirationDate>
pub fn get_expiration_date(&self) -> Option<ExpirationDate>
Returns the expiration date of the option contract.
§Returns
An ExpirationDate
representing when the option expires, either as days to expiration or a specific datetime
Sourcepub fn get_risk_free_rate(&self) -> Option<Decimal>
pub fn get_risk_free_rate(&self) -> Option<Decimal>
Returns the risk-free interest rate used in pricing calculations.
§Returns
A Decimal
value representing the current risk-free rate
Sourcepub fn get_dividend_yield(&self) -> Option<Positive>
pub fn get_dividend_yield(&self) -> Option<Positive>
Returns the dividend yield of the underlying asset.
§Returns
A Positive
value representing the dividend yield of the underlying asset
Sourcepub fn get_symbol(&self) -> Option<String>
pub fn get_symbol(&self) -> Option<String>
Returns the symbol of the underlying asset.
§Returns
Option<String>
- The underlying symbol if available, orNone
if not set.
Trait Implementations§
Source§impl Clone for OptionDataPriceParams
impl Clone for OptionDataPriceParams
Source§fn clone(&self) -> OptionDataPriceParams
fn clone(&self) -> OptionDataPriceParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OptionDataPriceParams
impl Debug for OptionDataPriceParams
Source§impl Default for OptionDataPriceParams
impl Default for OptionDataPriceParams
Source§fn default() -> OptionDataPriceParams
fn default() -> OptionDataPriceParams
Source§impl<'de> Deserialize<'de> for OptionDataPriceParams
impl<'de> Deserialize<'de> for OptionDataPriceParams
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>,
Source§impl Display for OptionDataPriceParams
impl Display for OptionDataPriceParams
Source§impl PartialEq for OptionDataPriceParams
impl PartialEq for OptionDataPriceParams
Source§impl Serialize for OptionDataPriceParams
impl Serialize for OptionDataPriceParams
impl StructuralPartialEq for OptionDataPriceParams
Auto Trait Implementations§
impl Freeze for OptionDataPriceParams
impl RefUnwindSafe for OptionDataPriceParams
impl Send for OptionDataPriceParams
impl Sync for OptionDataPriceParams
impl Unpin for OptionDataPriceParams
impl UnwindSafe for OptionDataPriceParams
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.