コード例 #1
0
        public PortfolioPath(int yearsUntilRetirement, double expectedReturn, double variance, double initialPortfolioValue, double annualContribution, double incomeDraw, int yearsPlannedRetirement)
        {
            this.folioReturn           = expectedReturn;
            this.folioStDev            = Math.Sqrt(variance) / 100;
            this.annualContribution    = annualContribution;
            this.incomeDraw            = incomeDraw;
            this.initialPortfolioValue = initialPortfolioValue;
            this.retirement            = yearsUntilRetirement;
            this.nSteps             = retirement + yearsPlannedRetirement;
            this.portfolioValueList = new List <decimal>();
            this.portfolioValueList.Add((decimal)initialPortfolioValue);
            LogNormal            lognormal = LogNormal.WithMuSigma(folioReturn, folioStDev);
            IEnumerable <double> returns   = lognormal.Samples().Take(nSteps);

            this.endingPortfolioValue = returns.Aggregate(initialPortfolioValue, ComputeNextPortfolioValue);
        }