public int GetAccruedInterestDays(Date calcDate, Cashflow[] cashflows, bool isEod = false) { if (calcDate < StartDate || calcDate >= UnderlyingMaturityDate) { return(0); } return(AiCalculation.GetAccruedInterestDays(calcDate, cashflows, isEod)); }
public int GetAccruedInterestDays(Date calcDate, IMarketCondition market, bool isEod = false) { if (calcDate < StartDate || calcDate >= UnderlyingMaturityDate) { return(0); } var cashflows = GetAiCashflows(market, false); return(AiCalculation.GetAccruedInterestDays(calcDate, cashflows, isEod)); }
public double GetAccruedInterest(Date calcDate, Cashflow[] cashflows, bool isEod = false) { if (calcDate < StartDate || calcDate >= UnderlyingMaturityDate) { return(0.0); } if (IsZeroCouponBond) { if (double.IsNaN(IssuePrice)) { throw new PricingLibraryException("Issue price is missing in calculating ai of zero coupon bond"); } var totalInterest = Notional - IssuePrice; return((PaymentDayCount.DaysInPeriod(StartDate, calcDate) + (isEod ? 1 : 0)) / PaymentDayCount.DaysInPeriod(StartDate, UnderlyingMaturityDate) * totalInterest); } return(AiCalculation.GetAccruedInterest(calcDate, cashflows, AccrualDayCount, isEod)); }