pub struct RainbowOption {Show 13 fields
pub symbol: String,
pub rainbow_type: RainbowType,
pub put_or_call: PutOrCall,
pub spots: Vec<f64>,
pub vols: Vec<f64>,
pub dividends: Vec<f64>,
pub correlations: Vec<Vec<f64>>,
pub strike_price: f64,
pub weights: Vec<f64>,
pub maturity_date: NaiveDate,
pub valuation_date: NaiveDate,
pub discount_curve: YieldCurve,
pub engine: PricingEngine,
/* private fields */
}Fields§
§symbol: String§rainbow_type: RainbowType§put_or_call: PutOrCall§spots: Vec<f64>§vols: Vec<f64>§dividends: Vec<f64>§correlations: Vec<Vec<f64>>§strike_price: f64§weights: Vec<f64>§maturity_date: NaiveDate§valuation_date: NaiveDate§discount_curve: YieldCurve§engine: PricingEngineThe numerical method with its settings. Rainbow payoffs price on
the analytic engine (Margrabe / Kirk / moment matching) or Monte
Carlo (terminal correlated GBM: paths, sampler and seed from
the config; time_steps/scheme do not apply).
Implementations§
Source§impl RainbowOption
impl RainbowOption
Sourcepub fn from_json(data: &RainbowOptionData) -> Box<RainbowOption>
pub fn from_json(data: &RainbowOptionData) -> Box<RainbowOption>
Build from contract data, panicking on any invalid field. Fallible
callers should use RainbowOption::try_from_json.
pub fn try_from_json( data: &RainbowOptionData, ) -> Result<Box<RainbowOption>, RustyQLibError>
pub fn time_to_maturity(&self) -> f64
pub fn npv_with_stats(&self) -> Option<McStats>
pub fn theta(&self) -> f64
pub fn rho(&self) -> f64
Trait Implementations§
Source§impl Debug for RainbowOption
impl Debug for RainbowOption
Source§impl Instrument for RainbowOption
impl Instrument for RainbowOption
Source§fn price(&self) -> Result<PricingResult, RustyQLibError>
fn price(&self) -> Result<PricingResult, RustyQLibError>
Value, scalar theta/rho and (under Monte Carlo) the standard
error. Spot Greeks are per-asset for rainbows — see
RainbowOption::deltas and RainbowOption::vegas — so the
scalar delta/gamma/vega slots stay zero.
Source§fn try_npv(&self) -> Result<f64, RustyQLibError>
fn try_npv(&self) -> Result<f64, RustyQLibError>
Present value, or a typed error when the instrument cannot be priced
(invalid inputs, or an engine/product combination the library
refuses to price).
Source§fn npv(&self) -> f64
fn npv(&self) -> f64
Present value, panicking on any pricing error. Convenience for
instruments already known to be valid; fallible callers (batch
pricing, services) should use
Instrument::try_npv.Auto Trait Implementations§
impl Freeze for RainbowOption
impl RefUnwindSafe for RainbowOption
impl Send for RainbowOption
impl Sync for RainbowOption
impl Unpin for RainbowOption
impl UnsafeUnpin for RainbowOption
impl UnwindSafe for RainbowOption
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