private double WeightedAverageDuration(Loan loan)
        {
            var duration        = 0.0;
            var weightedAverage = loan.GetPayments().Sum(payment => YearsTo(payment.Date, loan) * payment.Amount);
            var sumOfPayments   = loan.GetPayments().Sum(payment => payment.Amount);

            if (Math.Abs(loan.GetCommitment()) > 0.0)
            {
                duration = weightedAverage / sumOfPayments;
            }

            return(duration);
        }
 public override double Capital(Loan loan)
 {
     return(loan.GetCommitment() * Duration(loan) * RiskFactor(loan));
 }