Struct LagAdjustment
pub struct LagAdjustment {
pub offset: i32,
pub unit: PaymentLagUnit,
pub convention: BusinessDayConvention,
pub calendar: Arc<dyn Calendar>,
}Expand description
A payment-lag (or generic date) adjustment.
apply advances by offset × unit on the calendar and then
rolls by the convention. A zero business-day offset is the identity on a date
that is already a good business day, so “no lag” keeps the payment date equal
to the accrual end.
Fields§
§offset: i32Signed offset length in units; negative looks back.
unit: PaymentLagUnitThe unit the offset is measured in.
convention: BusinessDayConventionThe business-day convention applied after advancing.
calendar: Arc<dyn Calendar>The calendar the offset and convention roll against.
Implementations§
§impl LagAdjustment
impl LagAdjustment
pub fn business_days(
offset: i32,
convention: BusinessDayConvention,
calendar: Arc<dyn Calendar>,
) -> Self
pub fn business_days( offset: i32, convention: BusinessDayConvention, calendar: Arc<dyn Calendar>, ) -> Self
A T+offset business-days lag against (convention, calendar).
pub fn from_payment_lag(
lag: &Period,
calendar: Arc<dyn Calendar>,
) -> Option<Self>
pub fn from_payment_lag( lag: &Period, calendar: Arc<dyn Calendar>, ) -> Option<Self>
The adjustment a template’s payment lag implies, or None for a zero
lag — which is the identity, and an identity adjustment is better left
absent than applied.
This is the half of the reference-data layer’s payment-lag test that could not live there: the lag values are reference data, but what a lag means for a cashflow is this layer’s business.
pub fn apply(&self, date: NaiveDate) -> NaiveDate
pub fn apply(&self, date: NaiveDate) -> NaiveDate
Advances date by offset × unit on the calendar, then adjusts.
For PaymentLagUnit::BusinessDays each counted step already lands on a
business day, so no post-adjustment is needed; for calendar units the
advanced date is rolled by the convention.
Trait Implementations§
§impl Clone for LagAdjustment
impl Clone for LagAdjustment
§fn clone(&self) -> LagAdjustment
fn clone(&self) -> LagAdjustment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more