pub struct Accumulator {}Expand description
An accumulator/decumulator on equally spaced daily observations.
Fields§
§side: AccumulatorSide§s0: f64§strike: f64§barrier: f64§observations: usize§t: f64Year fraction to maturity.
r: f64§q: f64§sigma: f64§gearing: f64§pricer: AccumulatorPricer§paths: usize§seed: u64Implementations§
Source§impl Accumulator
impl Accumulator
Sourcepub fn analytic_npv(&self) -> f64
pub fn analytic_npv(&self) -> f64
Strip-of-barrier-options closed form (continuous knock-out monitoring). Each observation contributes a knock-out pair maturing on its date.
Sourcepub fn mc_npv(&self) -> (f64, f64)
pub fn mc_npv(&self) -> (f64, f64)
Monte Carlo on the observation grid: discrete knock-out at each observation (the contractual daily-close convention), accrual up to but excluding the knock-out day. Deterministic per seed.
Sourcepub fn from_json(data: &AccumulatorData) -> Box<Accumulator>
pub fn from_json(data: &AccumulatorData) -> Box<Accumulator>
Build from contract data, panicking on any invalid field. Fallible
callers should use Accumulator::try_from_json.
pub fn try_from_json( data: &AccumulatorData, ) -> Result<Box<Accumulator>, RustyQLibError>
Trait Implementations§
Source§impl Clone for Accumulator
impl Clone for Accumulator
Source§fn clone(&self) -> Accumulator
fn clone(&self) -> Accumulator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Accumulator
impl Debug for Accumulator
Source§impl Instrument for Accumulator
impl Instrument for Accumulator
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 price(&self) -> Result<PricingResult, RustyQLibError>
fn price(&self) -> Result<PricingResult, RustyQLibError>
Price the instrument once, returning value, Greeks and (for Monte
Carlo engines) the standard error together in a
PricingResult. Read moreSource§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 Accumulator
impl RefUnwindSafe for Accumulator
impl Send for Accumulator
impl Sync for Accumulator
impl Unpin for Accumulator
impl UnsafeUnpin for Accumulator
impl UnwindSafe for Accumulator
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