code: function (values, dates, rate) {
          var r = rate + 1;
          var result = values[0];
          for (var i = 1; i < values.length; i++) {
            result += values[i] / Math.pow(r, moment(dates[i]).diff(moment(dates[0]), 'days') / 365);
          }
          return result;
        }
docs: Credits: algorithm inspired by Apache OpenOffice Calculates the resulting amount