예제 #1
0
        private void calculateYearsOfAdditions(List <double> rate)
        {
            List <Yearly> yearlies     = new List <Yearly>(yearsOfAdditions + yearsOfWithdrawls);
            double        currentValue = initialAmount;
            double        previousYear;

            for (int i = 0; i < yearsOfAdditions; i++)
            {
                currentValue += additions;
                currentValue += currentValue * rate[i];
                currentValue  = Math.Max(currentValue, 0);
                yearlies.Add(new Yearly(Math.Round(currentValue, 2), Math.Round(additions, 2), Math.Round(rate[i], 4)));
            }
            for (int i = yearsOfAdditions; i < yearsOfWithdrawls + yearsOfAdditions; i++)
            {
                previousYear  = currentValue;
                withdrawls    = PaymentCalculator.GetPayments(previousYear, rate[i], (yearsOfWithdrawls + yearsOfAdditions) - i);
                withdrawls    = Math.Max(withdrawls, 0);
                currentValue += currentValue * rate[i];
                currentValue -= withdrawls;
                currentValue  = Math.Max(currentValue, 0);
                yearlies.Add(new Yearly(Math.Round(currentValue, 2), Math.Round(-withdrawls, 2), Math.Round(rate[i], 4)));
            }

            mutex.WaitOne();
            Allpercentiles.Add(new Percentiles(yearlies));
            mutex.ReleaseMutex();
        }
예제 #2
0
        public AssetFactory(AssetModel assets, int retirementDate, int deathDate, double income)
        {
            int currentYear       = DateTime.Now.Year;
            int yearsToRetirement = retirementDate - currentYear;
            int yearsOfRetirement = deathDate - retirementDate;

            try
            {
                double additions    = double.Parse(assets.additions[0]);
                double currentValue = double.Parse(assets.amounts[0]);

                additions += Math.Min(((double.Parse(assets.matching[0]) / 100) * additions), ((double.Parse(assets.caps[0]) / 100) * income * (double.Parse(assets.matching[0]) / 100)));

                for (int i = yearsToRetirement; i > 0; i--)
                {
                    currentValue += (currentValue * rate);
                    currentValue += additions;
                }

                yearlyIncome = PaymentCalculator.GetPayments(currentValue, rate, yearsOfRetirement);
            }
            catch (ArgumentOutOfRangeException exception)
            {
                Console.WriteLine(exception);
                yearlyIncome = 0;
            }
        }
예제 #3
0
        public void CalculateBrokerageData(Brokerage stock)
        {
            rate -= extraFees;

            distributionsBeforeTax = PaymentCalculator.GetPayments(lumpSumAtRetirement, rate, yearsOfPayments);
            totalExpectedReturn    = distributionsBeforeTax * yearsOfPayments;

            //exclusion ratio is only non-zero if it a nonqualified annuity
            if (annuityTax == AnnuityTax.Nonqualified)
            {
                exclusionRatio = initialAmount / totalExpectedReturn;
            }
            else
            {
                exclusionRatio = 0;
            }

            CalculateRiders();
            CalculateTaxes();

            yearlyBreakdown = GetYearlyBreakdown(stock);
            if (annuityTax == AnnuityTax.Nonqualified)
            {
                afterTaxIncome = distributionsBeforeTax * (1 - taxRate) + yearlyNonTaxable;
            }
            else
            {
                afterTaxIncome = distributionsBeforeTax * (1 - taxRate);
            }

            afterTaxIncome = Math.Round(afterTaxIncome, 2);
            assetValue     = Math.Max(person.assetIncome * (1 - taxRate), 0);
            Math.Round(assetValue, 2);
        }
예제 #4
0
        public void GenerateOutput()
        {
            Confidence confidence = new Confidence(carlo.trialsList);

            confident75          = confidence.FindInterval(75);
            confident90          = confidence.FindInterval(90);
            amountAtRetirement75 = confident75[confident75.Count - 1];
            amountAtRetirement90 = confident90[confident90.Count - 1];
            int    yearsOfPayments  = (person.deathDate - person.retirementDate);
            double currentAmmount75 = amountAtRetirement75;
            double currentAmmount90 = amountAtRetirement90;
            double totalAmount;

            if (yearsOfLife == null)
            {
                yearsOfLife = yearsOfPayments;
            }

            growth75 = ((amountAtRetirement75 / confident75[0]) - 1) / (person.retirementDate - DateTime.Now.Year);
            growth90 = ((amountAtRetirement90 / confident90[0]) - 1) / (person.retirementDate - DateTime.Now.Year);

            withdrawl75 = Math.Round(PaymentCalculator.GetPayments(amountAtRetirement75, growth75, yearsOfPayments + 1), 2);
            withdrawl90 = Math.Round(PaymentCalculator.GetPayments(amountAtRetirement90, growth90, yearsOfPayments + 1), 2);

            totalAmount    = withdrawl75 * yearsOfPayments;
            exclusionRatio = person.lumpSum / totalAmount;
        }
예제 #5
0
        public DBRider(Person person, Annuities annuity)
        {
            annuity.DB = true;
            int growthYears = Math.Max(accumulation, person.retirementDate - DateTime.Now.Year);

            if (annuity.annuityTime == AnnuityTime.Immediate)
            {
                growthYears = 0;
            }

            annuity.rate -= (annuity.extraFees + fee);
            annuity.distributionsBeforeTax = PaymentCalculator.GetPayments(annuity.lumpSumAtRetirement, annuity.rate, annuity.yearsOfPayments);
            annuity.totalExpectedReturn    = annuity.distributionsBeforeTax * annuity.yearsOfPayments;
            annuity.exclusionRatio         = 0;

            if (annuity.annuityTax == AnnuityTax.Qualified)
            {
                annuity.exclusionRatio = annuity.initialAmount / annuity.totalExpectedReturn;
            }
        }
예제 #6
0
        //calculates how much money a variable annuity will payout for a given year
        private List <double> VariableCalc(double carloRate)
        {
            List <double> currentYear   = new List <double>();
            double        currentAmount = initialAmount;

            lumpSumAtRetirement = FutureValue.GetFutureValue(initialAmount, carloRate, yearsToRetirement);
            currentYear.Add(initialAmount);
            if (annuityTime == AnnuityTime.Deferred)
            {
                for (int j = 0; j < yearsToRetirement; j++)
                {
                    currentAmount += lumpSumAtRetirement / yearsToRetirement;
                    currentYear.Add(currentAmount);
                }
            }
            distributionsBeforeTax = PaymentCalculator.GetPayments(currentAmount, carloRate, yearsOfPayments);
            if (glwb)
            {
                yearsOfPayments += 100;
            }
            for (int j = 0; j < yearsOfPayments; j++)
            {
                currentAmount += currentAmount * carloRate;
                if (gmwb || glwb)
                {
                    currentAmount -= distributionsBeforeTax;
                    currentAmount  = Math.Max((currentAmount - distributionsBeforeTax), (rider.annualIncome));
                }
                else
                {
                    currentAmount -= distributionsBeforeTax;
                    currentAmount  = Math.Max(0, currentAmount);
                }
                currentYear.Add(currentAmount);
            }
            return(currentYear);
        }