Browse Source
Bugfix/missing benchmark in performance chart for calendar year date ranges (#7631)
* Fix missing benchmark in performance chart for calendar year date ranges
* Update changelog
pull/7726/head
Aaryaman Vyas
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
10 additions and
3 deletions
-
CHANGELOG.md
-
apps/api/src/app/endpoints/benchmarks/benchmarks.service.ts
|
|
|
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed the missing benchmark in the performance chart for calendar year date ranges on the analysis page |
|
|
|
- Fixed the country mapping of Macau in the _Financial Modeling Prep_ service |
|
|
|
- Fixed the asset profile and historical market data gathering of a symbol getting blocked permanently by a failed job by discarding the failed jobs |
|
|
|
- Fixed the asset profile data gathering of a symbol in the admin control panel by removing an existing job before enqueueing a new one |
|
|
|
|
|
|
|
@ -88,6 +88,12 @@ export class BenchmarksService { |
|
|
|
return { marketData }; |
|
|
|
} |
|
|
|
|
|
|
|
if (chart.length === 0) { |
|
|
|
return { marketData }; |
|
|
|
} |
|
|
|
|
|
|
|
const baselineDate = resetHours(parseDate(chart[0].date)); |
|
|
|
|
|
|
|
const exchangeRates = |
|
|
|
await this.exchangeRateDataService.getExchangeRatesByCurrency({ |
|
|
|
startDate, |
|
|
|
@ -97,17 +103,17 @@ export class BenchmarksService { |
|
|
|
|
|
|
|
const exchangeRateAtStartDate = |
|
|
|
exchangeRates[`${currentSymbolItem.currency}${userCurrency}`]?.[ |
|
|
|
format(startDate, DATE_FORMAT) |
|
|
|
format(baselineDate, DATE_FORMAT) |
|
|
|
]; |
|
|
|
|
|
|
|
const marketPriceAtStartDate = marketDataItems?.find(({ date }) => { |
|
|
|
return isSameDay(date, startDate); |
|
|
|
return isSameDay(date, baselineDate); |
|
|
|
})?.marketPrice; |
|
|
|
|
|
|
|
if (!marketPriceAtStartDate) { |
|
|
|
this.logger.error( |
|
|
|
`No historical market data has been found for ${symbol} (${dataSource}) at ${format( |
|
|
|
startDate, |
|
|
|
baselineDate, |
|
|
|
DATE_FORMAT |
|
|
|
)}` |
|
|
|
); |
|
|
|
|