Files
marketdata/MarketDataLib/Utility/DateRange.cs
2024-02-22 14:52:53 -05:00

29 lines
774 B
C#

using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace MarketData.Utils
{
public class DateRange : List<DateTime>
{
public DateRange(DateTime startDate,DateTime endDate)
{
startDate = startDate.Date;
endDate=endDate.Date;
DateGenerator dateGenerator=new DateGenerator();
List<DateTime> dates= dateGenerator.GenerateHistoricalDates(startDate, endDate);
foreach (DateTime date in dates) Add(date);
Sort(); // ensure that no matter how we set this up, the oldest date winds up being at the lowest index of the list
}
public DateTime StartDate
{
get { return this[0]; }
}
public DateTime EndDate
{
get { return this[Count-1]; }
}
}
}