using System; using EvoCalculator.Core.FinanceFormulas; using EvoCalculator.Core.Models.Common; namespace EvoCalculator.Core.Base.Columns; public class BaseColumnWithXNPV : BaseColumn { private readonly double rate; public BaseColumnWithXNPV(int count, BaseColumn dateTempColumn, double rate) : base(count) { Dates = dateTempColumn.Values; this.rate = rate; } private DateTime[] Dates { get; } private Flow[] Flows { get { var flows = new Flow[Values.Length]; for (var i = 0; i < Values.Length; i++) flows[i] = new Flow { Date = Dates[i], Value = Values[i] }; return flows; } } public decimal XNPV { get { var XNPV = new XNPV(Flows, rate); return Convert.ToDecimal(XNPV.GetResult()); } } }