pub enum Compounding {
Continuous,
Periodic(NonZeroU32),
Simple,
}Expand description
Compounding convention used to translate a yield into a discount factor or to compose forward rates.
Periodic(n) covers the common cases:
Periodic(NonZeroU32::new(1).unwrap())— annual compounding,(1+r)^t.Periodic(NonZeroU32::new(2).unwrap())— semi-annual,(1+r/2)^(2t).Periodic(NonZeroU32::new(12).unwrap())— monthly.Periodic(NonZeroU32::new(252).unwrap())— Brazilian business-day convention (one compounding per business day).
Variants§
Continuous
Continuous compounding: DF = exp(-r*t).
Periodic(NonZeroU32)
Periodic compounding n times per year: DF = (1 + r/n)^(-n*t).
Simple
Simple (linear) interest: DF = 1 / (1 + r*t).
Implementations§
Source§impl Compounding
impl Compounding
Sourcepub fn semi_annual() -> Self
pub fn semi_annual() -> Self
Convenience constructor for semi-annual compounding (Periodic(2)).
Trait Implementations§
Source§impl Clone for Compounding
impl Clone for Compounding
Source§fn clone(&self) -> Compounding
fn clone(&self) -> Compounding
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 moreimpl Copy for Compounding
Source§impl Debug for Compounding
impl Debug for Compounding
impl Eq for Compounding
Source§impl PartialEq for Compounding
impl PartialEq for Compounding
Source§fn eq(&self, other: &Compounding) -> bool
fn eq(&self, other: &Compounding) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Compounding
Auto Trait Implementations§
impl Freeze for Compounding
impl RefUnwindSafe for Compounding
impl Send for Compounding
impl Sync for Compounding
impl Unpin for Compounding
impl UnsafeUnpin for Compounding
impl UnwindSafe for Compounding
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