Esempio n. 1
0
        protected override void OnInitialMonth()
        {
            _homeValue = Simulation.HomePurchaseAmount;
            Report.AddNote(WriteLine($"* {_homeValue:C0} home value"));
            _loanBalance = Simulation.OwnerLoanAmount;
            Report.AddNote(WriteLine($"* {_loanBalance:C0} loan amount"));
            _insurancePerMonth = Simulation.InsurancePerMonth;
            _hoaPerMonth       = Simulation.HoaPerMonth;

            InitialCash += Simulation.OwnerDownPayment;
            Report.AddNote(WriteLine($"* {Simulation.OwnerDownPayment:C0} down payment"));

            var buyerFixedCosts = Simulation.BuyerFixedCosts;

            WriteLine($"* {Simulation.BuyerFixedCosts:C0} buyer fixed costs");
            var buyerVariableCosts = Simulation.OwnerLoanAmount * Simulation.BuyerVariableCostsPercentage;

            WriteLine($"* {buyerVariableCosts:C0} buyer variable costs of {Simulation.BuyerVariableCostsPercentage:P2}");
            var buyerCosts = buyerFixedCosts + buyerVariableCosts;

            InitialCash += buyerCosts;
            Report.AddNote(WriteLine($"* {buyerCosts:C0} total buyer costs"));

            Report.AddNote(WriteLine($"* {InitialCash:C0} starting cash"));

            Report.DiscountRatePerYear = Simulation.DiscountRatePerYear;
            WriteLine($"* {Report.DiscountRatePerYear:P2} annual discount rate; {Financial.ConvertDiscountRateYearToMonth(Report.DiscountRatePerYear):P6} monthly discount rate");
            Report.Add(new OwnerData
            {
                CashFlow    = -InitialCash,
                LoanBalance = _loanBalance,
                HomeValue   = _homeValue,
            });
        }
Esempio n. 2
0
        protected override void OnInitialMonth()
        {
            _insurancePerMonth = Simulation.RentersInsurancePerMonth;
            _rentPerMonth      = Simulation.RentPerMonth;
            Report.AddNote(WriteLine($"* {_rentPerMonth:C0} initial rent"));

            InitialCash =
                Simulation.OwnerDownPayment +
                Simulation.BuyerFixedCosts +
                Simulation.OwnerLoanAmount *
                Simulation.BuyerVariableCostsPercentage;

            Report.AddNote(WriteLine($"* {InitialCash:C0} starting cash"));
            VerboseLine($"    * {Simulation.OwnerDownPayment:C0} down payment");
            VerboseLine($"    * {Simulation.BuyerFixedCosts:C0} fixed closing costs");
            VerboseLine($"    * {Simulation.OwnerLoanAmount * Simulation.BuyerVariableCostsPercentage:C0} variable closing costs");

            _securityDeposit = (Simulation.RentSecurityDepositMonths * Simulation.RentPerMonth).ToDollars();
            Report.AddNote(WriteLine($"* {_securityDeposit:C0} security deposit"));
            _invested = Math.Max(0, InitialCash - _securityDeposit);
            _basis    = _invested;
            Report.AddNote(WriteLine($"* {_invested:C0} invested @ {Simulation.DiscountRatePerYear:P2}"));

            Report.DiscountRatePerYear = Simulation.DiscountRatePerYear;
            WriteLine($"* {Report.DiscountRatePerYear:P2} annual discount rate; {Financial.ConvertDiscountRateYearToMonth(Report.DiscountRatePerYear):P6} monthly discount rate");
            Report.Add(new RenterData
            {
                CashFlow = -InitialCash,
            });
        }
Esempio n. 3
0
        protected override void OnInitialMonth()
        {
            _homeValue = Simulation.HomePurchaseAmount;
            Report.AddNote(WriteLine($"* {_homeValue:C0} home value"));
            _loanBalance = Simulation.LandlordLoanAmount;
            Report.AddNote(WriteLine($"* {_loanBalance:C0} loan amount"));
            _insurancePerMonth = Simulation.InsurancePerMonth;
            _hoaPerMonth       = Simulation.HoaPerMonth;

            InitialCash += Simulation.LandlordDownPayment;
            Report.AddNote(WriteLine($"* {Simulation.LandlordDownPayment:C0} down payment"));

            var buyerFixedCosts = Simulation.BuyerFixedCosts;

            WriteLine($"* {Simulation.BuyerFixedCosts:C0} buyer fixed costs");
            var buyerVariableCosts = Simulation.LandlordLoanAmount * Simulation.BuyerVariableCostsPercentage;

            WriteLine($"* {buyerVariableCosts:C0} buyer variable costs of {Simulation.BuyerVariableCostsPercentage:P2}");
            var buyerCosts = buyerFixedCosts + buyerVariableCosts;

            InitialCash += buyerCosts;
            Report.AddNote(WriteLine($"* {buyerCosts:C0} total buyer costs"));

            _basis = Simulation.HomePurchaseAmount + buyerCosts;
            Report.AddNote(WriteLine($"* {_basis:C0} home value basis"));

            _securityDeposit = (Simulation.RentSecurityDepositMonths * Simulation.RentPerMonth).ToDollars();
            InitialCash     -= _securityDeposit;
            Report.AddNote(WriteLine($"* {_securityDeposit:C0} security deposit received"));

            Report.AddNote(WriteLine($"* {InitialCash:C0} starting cash"));

            _rentPerMonth = Simulation.RentPerMonth;
            Report.AddNote(WriteLine($"* {_rentPerMonth:C0} initial rent"));

            Report.DiscountRatePerYear = Simulation.DiscountRatePerYear;
            WriteLine($"* {Report.DiscountRatePerYear:P2} annual discount rate; {Financial.ConvertDiscountRateYearToMonth(Report.DiscountRatePerYear):P6} monthly discount rate");
            Report.Add(new LandlordData
            {
                CashFlow    = -InitialCash,
                LoanBalance = _loanBalance,
                HomeValue   = _homeValue,
            });
        }
Esempio n. 4
0
        public void Calculate(ReportGrouping grouping, double discountRatePerYear)
        {
            // The underlying data is always monthly
            var discountRate = grouping == ReportGrouping.Yearly ? discountRatePerYear : Financial.ConvertDiscountRateYearToMonth(discountRatePerYear);

            if (CalculateNpv)
            {
                Npv = (decimal)Financials.Npv.Calculate(_cashFlows, discountRate);
            }
            if (CalculateIrr)
            {
                var irr = Financials.Irr.Calculate(_cashFlows, discountRate);
                Irr = double.IsNaN(irr) ? 0m : (decimal)irr;
            }

            // If we ask for yearly, convert the resulting IRR
            if (grouping == ReportGrouping.Monthly)
            {
                Irr = Financial.ConvertDiscountRateMonthToYear(Irr);
            }
        }