|
|
@ -100,9 +100,15 @@ export class BenchmarksService { |
|
|
format(startDate, DATE_FORMAT) |
|
|
format(startDate, DATE_FORMAT) |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
const marketPriceAtStartDate = marketDataItems?.find(({ date }) => { |
|
|
// The start date is exclusive for calendar year date ranges, hence it is
|
|
|
return isSameDay(date, startDate); |
|
|
// not part of the chart and needs to be queried separately
|
|
|
})?.marketPrice; |
|
|
const marketDataItemAtStartDate = await this.marketDataService.get({ |
|
|
|
|
|
dataSource, |
|
|
|
|
|
symbol, |
|
|
|
|
|
date: startDate |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const marketPriceAtStartDate = marketDataItemAtStartDate?.marketPrice; |
|
|
|
|
|
|
|
|
if (!marketPriceAtStartDate) { |
|
|
if (!marketPriceAtStartDate) { |
|
|
this.logger.error( |
|
|
this.logger.error( |
|
|
@ -139,7 +145,7 @@ export class BenchmarksService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const includesEndDate = isSameDay( |
|
|
const includesEndDate = isSameDay( |
|
|
parseDate(marketData.at(-1).date), |
|
|
parseDate(marketData.at(-1)?.date), |
|
|
endDate |
|
|
endDate |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|