//public List<CashFlow> interestCashflows() //{ // List<CashFlow> icf = new List<CashFlow>(); // foreach (CashFlow cf in cashflows()) // { // if (cf is QLNet.FixedRateCoupon) // icf.Add(cf); // } // return icf; //} public List<CashFlow> expectedCashflows() { calcBondFactor(); List<CashFlow> expectedcashflows = new List<CashFlow>(); List<double> notionals = new InitializedList<double>(schedule_.Count); notionals[0] = notionals_[0]; for (int i = 0; i < schedule_.Count - 1; ++i) { double currentNotional = notionals[i]; double smm = SMM(schedule_[i]); double prepay = (notionals[i] * bondFactors_[i + 1]) / bondFactors_[i] * smm; double actualamort = currentNotional * (1 - bondFactors_[i + 1] / bondFactors_[i]); notionals[i + 1] = currentNotional - actualamort - prepay; // ADD CashFlow c1 = new VoluntaryPrepay(prepay, schedule_[i + 1]); CashFlow c2 = new AmortizingPayment(actualamort, schedule_[i + 1]); CashFlow c3 = new FixedRateCoupon(currentNotional, schedule_[i + 1], new InterestRate(PassThroughRate_, dCounter_, Compounding.Simple), schedule_[i], schedule_[i + 1]); expectedcashflows.Add(c1); expectedcashflows.Add(c2); expectedcashflows.Add(c3); } notionals[notionals.Count - 1] = 0.0; return expectedcashflows; }
//public List<CashFlow> interestCashflows() //{ // List<CashFlow> icf = new List<CashFlow>(); // foreach (CashFlow cf in cashflows()) // { // if (cf is QLNet.FixedRateCoupon) // icf.Add(cf); // } // return icf; //} public List <CashFlow> expectedCashflows() { calcBondFactor(); List <CashFlow> expectedcashflows = new List <CashFlow>(); List <double> notionals = new InitializedList <double>(schedule_.Count); notionals[0] = notionals_[0]; for (int i = 0; i < schedule_.Count - 1; ++i) { double currentNotional = notionals[i]; double smm = SMM(schedule_[i]); double prepay = (notionals[i] * bondFactors_[i + 1]) / bondFactors_[i] * smm; double actualamort = currentNotional * (1 - bondFactors_[i + 1] / bondFactors_[i]); notionals[i + 1] = currentNotional - actualamort - prepay; // ADD CashFlow c1 = new VoluntaryPrepay(prepay, schedule_[i + 1]); CashFlow c2 = new AmortizingPayment(actualamort, schedule_[i + 1]); CashFlow c3 = new FixedRateCoupon(currentNotional, schedule_[i + 1], new InterestRate(PassThroughRate_, dCounter_, Compounding.Simple, Frequency.Annual), schedule_[i], schedule_[i + 1]); expectedcashflows.Add(c1); expectedcashflows.Add(c2); expectedcashflows.Add(c3); } notionals[notionals.Count - 1] = 0.0; return(expectedcashflows); }