|
|
|
@ -2,7 +2,10 @@ import { ActivitiesService } from '@ghostfolio/api/app/activities/activities.ser |
|
|
|
import { LogPerformance } from '@ghostfolio/api/interceptors/performance-logging/performance-logging.interceptor'; |
|
|
|
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; |
|
|
|
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; |
|
|
|
import { resetHours } from '@ghostfolio/common/helper'; |
|
|
|
import { |
|
|
|
getAssetProfileIdentifier, |
|
|
|
resetHours |
|
|
|
} from '@ghostfolio/common/helper'; |
|
|
|
import { |
|
|
|
AssetProfileIdentifier, |
|
|
|
DataProviderInfo, |
|
|
|
@ -114,8 +117,8 @@ export class CurrentRateService { |
|
|
|
errors: quoteErrors.map(({ dataSource, symbol }) => { |
|
|
|
return { dataSource, symbol }; |
|
|
|
}), |
|
|
|
values: uniqBy(values, ({ date, symbol }) => { |
|
|
|
return `${date}-${symbol}`; |
|
|
|
values: uniqBy(values, ({ dataSource, date, symbol }) => { |
|
|
|
return `${date}-${getAssetProfileIdentifier({ dataSource, symbol })}`; |
|
|
|
}) |
|
|
|
}; |
|
|
|
|
|
|
|
@ -124,7 +127,11 @@ export class CurrentRateService { |
|
|
|
try { |
|
|
|
// If missing quote, fallback to the latest available historical market price
|
|
|
|
let value: GetValueObject = response.values.find((currentValue) => { |
|
|
|
return currentValue.symbol === symbol && isToday(currentValue.date); |
|
|
|
return ( |
|
|
|
currentValue.dataSource === dataSource && |
|
|
|
currentValue.symbol === symbol && |
|
|
|
isToday(currentValue.date) |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
if (!value) { |
|
|
|
@ -147,7 +154,11 @@ export class CurrentRateService { |
|
|
|
|
|
|
|
const [latestValue] = response.values |
|
|
|
.filter((currentValue) => { |
|
|
|
return currentValue.symbol === symbol && currentValue.marketPrice; |
|
|
|
return ( |
|
|
|
currentValue.dataSource === dataSource && |
|
|
|
currentValue.marketPrice && |
|
|
|
currentValue.symbol === symbol |
|
|
|
); |
|
|
|
}) |
|
|
|
.sort((a, b) => { |
|
|
|
if (a.date < b.date) { |
|
|
|
|