Thursday, 17 July 2014

Code for calculating pension projections

void Main()
{
 // This projection works for personal pensions
 // var performance = 1.0489m;
 var performance = 1.05m;
 // performance = 1.0196m;
 // performance = 1.0782m;
 var inflation = 1.025m;
 var initialFund = 35370;
 var fund = initialFund;
 
 // See the Fisher equation
 var nominalRate = performance / inflation;
 var nominalDisplayRate = ((nominalRate) - 1) * 100;
 nominalRate.Dump();
 string.Format("Projection: {0:0.##}%", nominalDisplayRate).Dump();
 
 var year1 = (nominalRate * initialFund);
 year1 = (int)(year1/100) * 100;
 string.Format("Year 1: {0:0.##}", year1).Dump();
 
 var year3 = (nominalRate * nominalRate * nominalRate * initialFund);
 year3 = (int)(year3/100) * 100;
 string.Format("Year 3: {0:0.##}", year3).Dump();
 
 var year5 = (nominalRate * nominalRate * nominalRate * nominalRate * nominalRate * initialFund);
 year5 = (int)(year5/100) * 100;
 string.Format("Year 5: {0:0.##}", year5).Dump();
 
 var yearX = Math.Pow((double)nominalRate, 10) * initialFund;
 yearX = (int)(yearX/100) * 100;
 string.Format("Year 10: {0:0.##}", yearX).Dump();
 
// for (var i = 1; i<=365; i++)
// {
//  49500m
// }
}

No comments:

Post a Comment