37 lines
960 B
C#
37 lines
960 B
C#
using System;
|
|
using EvoCalculator.Core.FinanceFormulas;
|
|
using EvoCalculator.Core.Models.Calculation.Interfaces;
|
|
|
|
namespace EvoCalculator.Core.Models.Calculation.Models
|
|
{
|
|
public class BaseColumnWithXIRR : IColumnWithXIRR<double>
|
|
{
|
|
public double[] Values { get; set; }
|
|
public double IRR { get; set; }
|
|
public DateTime[] Dates { get; set; }
|
|
|
|
protected Flow[] Flows
|
|
{
|
|
get
|
|
{
|
|
Flow[] 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 void ComputeXIRR()
|
|
{
|
|
var XIRR = new XIRR(this.Flows);
|
|
IRR = XIRR.GetResult();
|
|
}
|
|
}
|
|
} |