2023-04-21 11:14:31 +03:00

18 lines
473 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using EvoCalculator.Core.Models.Сerebellum.FinGAP.Models;
namespace EvoCalculator.Core.Base.Columns;
public class BaseColumnWithNPV : BaseColumn<decimal>
{
public BaseColumnWithNPV(int count) : base(count)
{
}
public decimal NPV(IEnumerable<decimal> values, double rate)
{
return values.Select((value, n) => value / (decimal)Math.Pow(1 + rate / 12, n + 1)).Sum();
}
}