pub struct BinomialTree {
pub spot: f64,
pub strike: f64,
pub rate: f64,
pub volatility: f64,
pub maturity: f64,
pub steps: usize,
pub dividend_yield: f64,
}Expand description
Binomial tree model for option pricing
Fields§
§spot: f64Spot price (current value)
strike: f64Strike price (exercise cost)
rate: f64Risk-free rate (annual)
volatility: f64Volatility (annual)
maturity: f64Time to maturity (years)
steps: usizeNumber of time steps
dividend_yield: f64Dividend yield (continuous)
Implementations§
Source§impl BinomialTree
impl BinomialTree
Sourcepub const fn new(
spot: f64,
strike: f64,
rate: f64,
volatility: f64,
maturity: f64,
steps: usize,
) -> Self
pub const fn new( spot: f64, strike: f64, rate: f64, volatility: f64, maturity: f64, steps: usize, ) -> Self
Create a new binomial tree model
Sourcepub const fn with_dividend_yield(self, yield_rate: f64) -> Self
pub const fn with_dividend_yield(self, yield_rate: f64) -> Self
Set dividend yield
Sourcepub fn call_price(&self, style: OptionStyle) -> f64
pub fn call_price(&self, style: OptionStyle) -> f64
Price a call option
Sourcepub fn put_price(&self, style: OptionStyle) -> f64
pub fn put_price(&self, style: OptionStyle) -> f64
Price a put option
Sourcepub fn defer_option_value(&self, max_deferral: f64, exercise_cost: f64) -> f64
pub fn defer_option_value(&self, max_deferral: f64, exercise_cost: f64) -> f64
Price a defer option (option to wait)
Sourcepub fn expand_option_value(
&self,
expansion_factor: f64,
exercise_cost: f64,
) -> f64
pub fn expand_option_value( &self, expansion_factor: f64, exercise_cost: f64, ) -> f64
Price an expand option
Sourcepub fn abandon_option_value(&self, salvage_value: f64) -> f64
pub fn abandon_option_value(&self, salvage_value: f64) -> f64
Price an abandon option
Sourcepub fn contract_option_value(
&self,
contraction_factor: f64,
cost_savings: f64,
) -> f64
pub fn contract_option_value( &self, contraction_factor: f64, cost_savings: f64, ) -> f64
Price a contract option
Auto Trait Implementations§
impl Freeze for BinomialTree
impl RefUnwindSafe for BinomialTree
impl Send for BinomialTree
impl Sync for BinomialTree
impl Unpin for BinomialTree
impl UnsafeUnpin for BinomialTree
impl UnwindSafe for BinomialTree
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