pub struct EquityOptionBuilder { /* private fields */ }Implementations§
Source§impl EquityOptionBuilder
impl EquityOptionBuilder
pub fn new() -> Self
pub fn symbol(self, symbol: &str) -> Self
pub fn spot(self, spot: f64) -> Self
pub fn strike(self, strike: f64) -> Self
pub fn flat_vol(self, vol: f64) -> Self
pub fn vol_surface(self, surface: VolSurface) -> Self
pub fn flat_rate(self, rate: f64) -> Self
pub fn discount_curve(self, curve: YieldCurve) -> Self
pub fn dividend_yield(self, q: f64) -> Self
Sourcepub fn borrow_cost(self, b: f64) -> Self
pub fn borrow_cost(self, b: f64) -> Self
Continuous stock borrow (repo) cost; part of the carry.
pub fn cash_dividend(self, date: NaiveDate, amount: f64) -> Self
Sourcepub fn on_future(self, settlement: FuturesSettlement) -> Self
pub fn on_future(self, settlement: FuturesSettlement) -> Self
Price the option on a future with Black-76: spot is then the
futures price F. European vanilla, Analytical engine only.
pub fn valuation_date(self, date: NaiveDate) -> Self
pub fn maturity_date(self, date: NaiveDate) -> Self
Sourcepub fn years_to_maturity(self, years: f64) -> Self
pub fn years_to_maturity(self, years: f64) -> Self
Convenience for examples: maturity = valuation + years * 365 days.
pub fn american(self) -> Self
Sourcepub fn bermudan(self, dates: Vec<NaiveDate>) -> Self
pub fn bermudan(self, dates: Vec<NaiveDate>) -> Self
Bermudan exercise on the given dates (expiry is always exercisable
through the terminal payoff). Overrides american() /
exercise_style(); applies to built-in payoffs, not payoff().
Sourcepub fn bermudan_schedule(self, months: u32, calendar: Calendar) -> Self
pub fn bermudan_schedule(self, months: u32, calendar: Calendar) -> Self
Bermudan exercise every months months on business-day adjusted
dates (modified following) from valuation to maturity, generated at
build() time.
pub fn exercise_style(self, style: ContractStyle) -> Self
pub fn payoff(self, payoff: Box<dyn Payoff>) -> Self
pub fn vanilla(self, put_or_call: PutOrCall) -> Self
pub fn binary( self, put_or_call: PutOrCall, binary_type: BinaryType, cash: f64, ) -> Self
pub fn barrier( self, put_or_call: PutOrCall, direction: BarrierDirection, knock: KnockType, barrier: f64, ) -> Self
Sourcepub fn double_barrier(
self,
put_or_call: PutOrCall,
knock: KnockType,
lower: f64,
upper: f64,
) -> Self
pub fn double_barrier( self, put_or_call: PutOrCall, knock: KnockType, lower: f64, upper: f64, ) -> Self
Double-barrier option on the corridor between the two levels.
Sourcepub fn barrier_rebate(self, rebate: f64, at_hit: bool) -> Self
pub fn barrier_rebate(self, rebate: f64, at_hit: bool) -> Self
Rebate on the most recently configured barrier payoff
(at_hit = true pays the knock-out rebate at the touch;
analytic engine only).
pub fn asian( self, put_or_call: PutOrCall, averaging: AveragingType, strike_type: AsianStrikeType, ) -> Self
Sourcepub fn lookback(
self,
put_or_call: PutOrCall,
lookback_type: LookbackType,
) -> Self
pub fn lookback( self, put_or_call: PutOrCall, lookback_type: LookbackType, ) -> Self
Lookback on the path extremum: floating strike pays against the min (call) / max (put); fixed strike pays the max (call) / min (put) against the built strike.
Sourcepub fn forward_start(
self,
put_or_call: PutOrCall,
strike_fraction: f64,
start_fraction: f64,
) -> Self
pub fn forward_start( self, put_or_call: PutOrCall, strike_fraction: f64, start_fraction: f64, ) -> Self
start_fraction is the strike-fixing time as a fraction of the
option’s life, in (0, 1).
pub fn autocallable( self, autocall_barrier: f64, protection_barrier: f64, coupon: f64, observations: usize, notional: f64, ) -> Self
Sourcepub fn autocall_observation_dates(self, dates: Vec<NaiveDate>) -> Self
pub fn autocall_observation_dates(self, dates: Vec<NaiveDate>) -> Self
Explicit autocall observation dates (e.g. from a
Schedule); must follow
.autocallable(...) or .phoenix(...). Overrides the equally
spaced observation count.
Sourcepub fn autocall_schedule(self, months: u32, calendar: Calendar) -> Self
pub fn autocall_schedule(self, months: u32, calendar: Calendar) -> Self
Generate business-day adjusted autocall observation dates every
months months from valuation to maturity on the given calendar
(modified following); must follow .autocallable(...) or
.phoenix(...). The schedule is built at build() time from the
final valuation and maturity dates.
Sourcepub fn phoenix(
self,
autocall_barrier: f64,
coupon_barrier: f64,
protection_barrier: f64,
coupon: f64,
observations: usize,
notional: f64,
memory: bool,
) -> Self
pub fn phoenix( self, autocall_barrier: f64, coupon_barrier: f64, protection_barrier: f64, coupon: f64, observations: usize, notional: f64, memory: bool, ) -> Self
Phoenix certificate: an autocallable whose coupon is paid at every
observation with S >= coupon_barrier (with optional memory),
rather than accruing as an at-call rebate.
Sourcepub fn accumulator(
self,
barrier: f64,
observations: usize,
shares_per_day: f64,
gearing: f64,
) -> Self
pub fn accumulator( self, barrier: f64, observations: usize, shares_per_day: f64, gearing: f64, ) -> Self
Accumulator: the holder buys shares_per_day at the strike (set
via .strike(...), below spot) on every equally spaced
observation day, knocked out when the spot reaches barrier
(above spot), with gearingx the quantity on days the spot closes
below the strike. Prices on the MonteCarlo engine.
Sourcepub fn decumulator(
self,
barrier: f64,
observations: usize,
shares_per_day: f64,
gearing: f64,
) -> Self
pub fn decumulator( self, barrier: f64, observations: usize, shares_per_day: f64, gearing: f64, ) -> Self
Decumulator: the mirror of accumulator —
sell at the strike (above spot), knocked out at barrier (below
spot), geared on days the spot closes above the strike.
pub fn engine(self, engine: Engine) -> Self
pub fn model(self, model: Model) -> Self
pub fn heston(self, params: HestonParams) -> Self
pub fn mc_config(self, cfg: MonteCarloConfig) -> Self
pub fn paths(self, paths: usize) -> Self
pub fn mc_time_steps(self, steps: usize) -> Self
pub fn seed(self, seed: u64) -> Self
pub fn fd_config(self, cfg: FdConfig) -> Self
pub fn fd_grid(self, spot_steps: usize, time_steps: usize) -> Self
pub fn lattice_config(self, cfg: LatticeConfig) -> Self
Sourcepub fn tree_type(self, tree_type: BinomialTreeType) -> Self
pub fn tree_type(self, tree_type: BinomialTreeType) -> Self
Binomial tree parameterization (default Leisen-Reimer).
Sourcepub fn tree_steps(self, steps: usize) -> Self
pub fn tree_steps(self, steps: usize) -> Self
Binomial tree steps (default 1000).
Sourcepub fn tree_term_structure(self) -> Self
pub fn tree_term_structure(self) -> Self
Price the binomial tree with term structures of rates and
volatility applied per step (tree_type is then ignored).
Sourcepub fn build(self) -> Result<EquityOption, RustyQLibError>
pub fn build(self) -> Result<EquityOption, RustyQLibError>
Validate every input and construct the option.
The invariant after a successful build() is that the option
prices: field domains are checked (positive spot, positive vol,
maturity after valuation, …), payoff-specific parameters are
checked, and the engine/model/payoff combination is verified, so
Instrument::price on
the result cannot fail with InvalidInput or UnsupportedEngine.
Only the configuration of the selected engine is validated: an out-of-domain Monte Carlo or grid setting is ignored when that engine is not the one pricing the option.