Skip to main content

EquityOptionBuilder

Struct EquityOptionBuilder 

Source
pub struct EquityOptionBuilder { /* private fields */ }

Implementations§

Source§

impl EquityOptionBuilder

Source

pub fn new() -> Self

Source

pub fn symbol(self, symbol: &str) -> Self

Source

pub fn spot(self, spot: f64) -> Self

Source

pub fn strike(self, strike: f64) -> Self

Source

pub fn flat_vol(self, vol: f64) -> Self

Source

pub fn vol_surface(self, surface: VolSurface) -> Self

Source

pub fn flat_rate(self, rate: f64) -> Self

Source

pub fn discount_curve(self, curve: YieldCurve) -> Self

Source

pub fn dividend_yield(self, q: f64) -> Self

Source

pub fn borrow_cost(self, b: f64) -> Self

Continuous stock borrow (repo) cost; part of the carry.

Source

pub fn cash_dividend(self, date: NaiveDate, amount: f64) -> Self

Source

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.

Source

pub fn valuation_date(self, date: NaiveDate) -> Self

Source

pub fn maturity_date(self, date: NaiveDate) -> Self

Source

pub fn years_to_maturity(self, years: f64) -> Self

Convenience for examples: maturity = valuation + years * 365 days.

Source

pub fn american(self) -> Self

Source

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().

Source

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.

Source

pub fn exercise_style(self, style: ContractStyle) -> Self

Source

pub fn payoff(self, payoff: Box<dyn Payoff>) -> Self

Source

pub fn vanilla(self, put_or_call: PutOrCall) -> Self

Source

pub fn binary( self, put_or_call: PutOrCall, binary_type: BinaryType, cash: f64, ) -> Self

Source

pub fn barrier( self, put_or_call: PutOrCall, direction: BarrierDirection, knock: KnockType, barrier: f64, ) -> Self

Source

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.

Source

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).

Source

pub fn asian( self, put_or_call: PutOrCall, averaging: AveragingType, strike_type: AsianStrikeType, ) -> Self

Source

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.

Source

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).

Source

pub fn autocallable( self, autocall_barrier: f64, protection_barrier: f64, coupon: f64, observations: usize, notional: f64, ) -> Self

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn engine(self, engine: Engine) -> Self

Source

pub fn model(self, model: Model) -> Self

Source

pub fn heston(self, params: HestonParams) -> Self

Source

pub fn mc_config(self, cfg: MonteCarloConfig) -> Self

Source

pub fn paths(self, paths: usize) -> Self

Source

pub fn mc_time_steps(self, steps: usize) -> Self

Source

pub fn seed(self, seed: u64) -> Self

Source

pub fn fd_config(self, cfg: FdConfig) -> Self

Source

pub fn fd_grid(self, spot_steps: usize, time_steps: usize) -> Self

Source

pub fn lattice_config(self, cfg: LatticeConfig) -> Self

Source

pub fn tree_type(self, tree_type: BinomialTreeType) -> Self

Binomial tree parameterization (default Leisen-Reimer).

Source

pub fn tree_steps(self, steps: usize) -> Self

Binomial tree steps (default 1000).

Source

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).

Source

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.

Trait Implementations§

Source§

impl Default for EquityOptionBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V