private static Loan CreateLoan(Loantypes loanType, int tenure, double interestRate, int principal, DateTime payoutDate, IDayCounter dayCalculator) { Loan loan; switch (loanType) { case Loantypes.FixedEmiLoan: loan = new FixedEmiLoan(dayCalculator); break; case Loantypes.FixedAmortizationLoan: loan = new FixedAmortizationLoan(dayCalculator); break; case Loantypes.FixedInterestLoan: loan = new FixedInterestLoan(dayCalculator); break; default: throw new ArgumentException("Loan type not implemented"); } ; loan.TenureYears = tenure; loan.InterestRate = interestRate; loan.StartAmount = principal; loan.CurrentPrincipal = principal; loan.PayoutDate = payoutDate; return(loan); }
public List <LoanPayment> Loan(Loantypes loanType, int tenure, double interestRate, int principal, DateTime payoutDate, bool addSinglePayment) { var loan = CreateLoan(loanType, tenure, interestRate, principal, payoutDate, new Thirty360Isda()); var res = CreateLoanPaymentPlan(loan, addSinglePayment); return(res); }