pub struct YieldTermStructure {
pub calendar: Box<dyn Calendar>,
pub day_counter: Box<dyn DayCounters>,
pub valuation_date: NaiveDate,
pub stripped_curves: Vec<StrippedCurve>,
}Expand description
Yield term structure - this includes raw market data (cash, fra, futures, swaps), which yields stripped curves. Using stripped curves, one can get desired zero rate, forward rate and discount.
Fields§
§calendar: Box<dyn Calendar>§day_counter: Box<dyn DayCounters>§valuation_date: NaiveDate§stripped_curves: Vec<StrippedCurve>Implementations§
Source§impl YieldTermStructure
impl YieldTermStructure
pub fn new( calendar: Box<dyn Calendar>, day_counter: Box<dyn DayCounters>, valuation_date: NaiveDate, stripped_curves: Vec<StrippedCurve>, ) -> Self
Sourcepub fn zero_rate(
&self,
date: NaiveDate,
interpolation_method_enum: &InterpolationMethodEnum,
) -> Result<f64>
pub fn zero_rate( &self, date: NaiveDate, interpolation_method_enum: &InterpolationMethodEnum, ) -> Result<f64>
Get zero rate by using stripped curve.
Sourcepub fn discount(
&self,
date: NaiveDate,
interpolation_method_enum: &InterpolationMethodEnum,
) -> Result<f64>
pub fn discount( &self, date: NaiveDate, interpolation_method_enum: &InterpolationMethodEnum, ) -> Result<f64>
Get discount factor by using stripped curve.
Sourcepub fn shifted_discount(
&self,
date: NaiveDate,
interpolation_method_enum: &InterpolationMethodEnum,
shift_bp: f64,
) -> Result<f64>
pub fn shifted_discount( &self, date: NaiveDate, interpolation_method_enum: &InterpolationMethodEnum, shift_bp: f64, ) -> Result<f64>
Discount factor under a parallel zero-rate shift of shift_bp basis
points, applied uniformly across all pillars. Mathematically equivalent
to constructing a new curve with every zero_rate bumped by
shift_bp · 1e-4 and calling discount on it — regardless of
interpolation scheme — because a constant-in-time shift factors out of
the zero-rate lookup. Used for bump-and-reprice IR Greeks (DV01,
gamma-1bp, modified duration).
Sourcepub fn forward_rate(
&self,
accrual_start_date: NaiveDate,
tenor: Period,
interpolation_method_enum: &InterpolationMethodEnum,
) -> Result<f64>
pub fn forward_rate( &self, accrual_start_date: NaiveDate, tenor: Period, interpolation_method_enum: &InterpolationMethodEnum, ) -> Result<f64>
Get forward rate from zero rate.
Trait Implementations§
Source§impl Debug for YieldTermStructure
impl Debug for YieldTermStructure
Source§impl<'de> Deserialize<'de> for YieldTermStructure
impl<'de> Deserialize<'de> for YieldTermStructure
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Observer for YieldTermStructure
impl Observer for YieldTermStructure
Auto Trait Implementations§
impl !RefUnwindSafe for YieldTermStructure
impl !Send for YieldTermStructure
impl !Sync for YieldTermStructure
impl !UnwindSafe for YieldTermStructure
impl Freeze for YieldTermStructure
impl Unpin for YieldTermStructure
impl UnsafeUnpin for YieldTermStructure
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.