コード例 #1
0
ファイル: Bond.cs プロジェクト: stepinto163/Qdp
 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));
 }