Added date range to global cache
This commit is contained in:
@@ -133,6 +133,22 @@ namespace MarketData.Cache
|
||||
return pricesByDate[date];
|
||||
}
|
||||
}
|
||||
|
||||
public Prices GetPrices(String symbol, DateTime earlierDate, DateTime laterDate)
|
||||
{
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
|
||||
if(laterDate<earlierDate)
|
||||
{
|
||||
DateTime tempDate = earlierDate;
|
||||
earlierDate = laterDate;
|
||||
laterDate=tempDate;
|
||||
}
|
||||
List<DateTime> datesList = dateGenerator.GenerateHistoricalDates(earlierDate, laterDate);
|
||||
datesList = datesList.Where(x => x >= earlierDate).ToList();
|
||||
return GetPrices(symbol, laterDate, datesList.Count);
|
||||
}
|
||||
|
||||
// The most recent price is returned at the lowest index
|
||||
public Prices GetPrices(String symbol,DateTime startDate,int dayCount)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user