pub struct VarianceSwap {
pub notional: f64,
pub strike_variance: f64,
pub t_remaining: f64,
pub r: f64,
pub fair_remaining_variance: f64,
pub accrued: Option<(f64, f64)>,
}Expand description
A (possibly seasoned) variance swap.
Fields§
§notional: f64Variance notional.
strike_variance: f64Strike in variance units.
t_remaining: f64Remaining time to maturity (years).
r: f64§fair_remaining_variance: f64Fair strike of the remaining variance (annualized).
accrued: Option<(f64, f64)>(elapsed years, annualized variance realized over them).
Implementations§
Source§impl VarianceSwap
impl VarianceSwap
Sourcepub fn expected_total_variance(&self) -> f64
pub fn expected_total_variance(&self) -> f64
Expected total-period annualized variance: the time-weighted blend of what has been realized and the fair value of the rest.
Sourcepub fn from_json(data: &VarianceSwapData) -> Box<VarianceSwap>
pub fn from_json(data: &VarianceSwapData) -> Box<VarianceSwap>
Build from contract data, panicking on any invalid field. Fallible
callers should use VarianceSwap::try_from_json.
pub fn try_from_json( data: &VarianceSwapData, ) -> Result<Box<VarianceSwap>, RustyQLibError>
Trait Implementations§
Source§impl Clone for VarianceSwap
impl Clone for VarianceSwap
Source§fn clone(&self) -> VarianceSwap
fn clone(&self) -> VarianceSwap
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 VarianceSwap
impl Debug for VarianceSwap
Source§impl Instrument for VarianceSwap
impl Instrument for VarianceSwap
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.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 moreAuto Trait Implementations§
impl Freeze for VarianceSwap
impl RefUnwindSafe for VarianceSwap
impl Send for VarianceSwap
impl Sync for VarianceSwap
impl Unpin for VarianceSwap
impl UnsafeUnpin for VarianceSwap
impl UnwindSafe for VarianceSwap
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